forked from phoedos/pmd
[dist] Add integration test for --debug flag
This commit is contained in:
pmd-dist/src/test/java/net/sourceforge/pmd/it
@ -93,6 +93,25 @@ public class BinaryDistributionIT extends AbstractBinaryDistributionTest {
|
||||
result.assertExecutionResult(4, "");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void logging() throws Exception {
|
||||
String srcDir = new File(".", "src/test/resources/sample-source/java/").getAbsolutePath();
|
||||
|
||||
ExecutionResult result;
|
||||
|
||||
result = PMDExecutor.runPMD(tempDir, "-d", srcDir, "-R", "src/test/resources/rulesets/sample-ruleset.xml",
|
||||
"-r", folder.newFile().toString());
|
||||
result.assertExecutionResult(4);
|
||||
result.assertErrorOutputContains("[main] INFO net.sourceforge.pmd.PMD - Loglevel is at INFO");
|
||||
|
||||
|
||||
// now with debug
|
||||
result = PMDExecutor.runPMD(tempDir, "-d", srcDir, "-R", "src/test/resources/rulesets/sample-ruleset.xml",
|
||||
"-r", folder.newFile().toString(), "--debug");
|
||||
result.assertExecutionResult(4);
|
||||
result.assertErrorOutputContains("[main] DEBUG net.sourceforge.pmd.PMD - Loglevel is at DEBUG");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runCPD() throws Exception {
|
||||
String srcDir = new File(".", "src/test/resources/sample-source-cpd/").getAbsolutePath();
|
||||
|
@ -105,6 +105,10 @@ public class ExecutionResult {
|
||||
report.contains(errorMessage));
|
||||
}
|
||||
|
||||
public void assertErrorOutputContains(String message) {
|
||||
assertTrue("erroroutput didn't contain " + message, errorOutput.contains(message));
|
||||
}
|
||||
|
||||
static class Builder {
|
||||
private int exitCode;
|
||||
private String output;
|
||||
|
Reference in New Issue
Block a user