Skip to content

Commit 28e179c

Browse files
bundoleeclaude
andcommitted
test: add stderr warning and flag combo tests per review feedback
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ba2794d commit 28e179c

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

java/opendataloader-pdf-cli/src/test/java/org/opendataloader/pdf/cli/CLIOptionsContentSafetyTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
import org.junit.jupiter.api.Test;
2323
import org.opendataloader.pdf.api.Config;
2424

25+
import java.io.ByteArrayOutputStream;
26+
import java.io.PrintStream;
27+
2528
import static org.junit.jupiter.api.Assertions.*;
2629

2730
class CLIOptionsContentSafetyTest {
@@ -75,4 +78,25 @@ void deprecatedSensitiveDataValueIsAccepted() throws Exception {
7578
assertFalse(config.getFilterConfig().isFilterSensitiveData(),
7679
"Deprecated sensitive-data value should not enable sanitization");
7780
}
81+
82+
@Test
83+
void deprecatedSensitiveDataValuePrintsWarning() throws Exception {
84+
PrintStream originalErr = System.err;
85+
ByteArrayOutputStream errContent = new ByteArrayOutputStream();
86+
System.setErr(new PrintStream(errContent));
87+
try {
88+
parseArgs("--output-dir", "/tmp", "--content-safety-off", "sensitive-data");
89+
assertTrue(errContent.toString().contains("deprecated"),
90+
"Should print a deprecation warning to stderr");
91+
} finally {
92+
System.setErr(originalErr);
93+
}
94+
}
95+
96+
@Test
97+
void sanitizeWithDeprecatedSensitiveDataStillEnablesSanitize() throws Exception {
98+
Config config = parseArgs("--output-dir", "/tmp", "--content-safety-off", "sensitive-data", "--sanitize");
99+
assertTrue(config.getFilterConfig().isFilterSensitiveData(),
100+
"--sanitize should win over deprecated --content-safety-off sensitive-data");
101+
}
78102
}

0 commit comments

Comments
 (0)