This commit is contained in:
Andreas Dangel committed 2023-12-07 20:05:35 +01:00
1 parent f73d75d5a3
commit dcdab9d792
1 file changed
+4 -5
+4 -5
View File
@@ -29,10 +29,13 @@ String pmdXml = readFile(pmdXmlReport);
if (!pmdXml.contains("<violation beginline=\"5\" endline=\"5\" begincolumn=\"16\" endcolumn=\"37\" rule=\"UnusedLocalVariable\" ruleset=\"Best Practices\" package=\"org.example\" class=\"Main\" method=\"main\" variable=\"thisIsAUnusedLocalVar\"")) {
throw new RuntimeException("Expected violation has not been reported");
}
File mainFile = new File("pmd-for-java/src/main/java/org/example/Main.java");
File mainFile = new File(basedir, "src/main/java/org/example/Main.java");
if (!pmdXml.contains(mainFile + "\">")) {
throw new RuntimeException("Expected violation has not been reported");
}
if (!pmdXml.contains("<error filename=\"" + mainFile.getAbsolutePath()) || !pmdXml.contains(mainFile + "\" msg=\"PmdXPathException")) {
throw new RuntimeException("Processing error has not been reported");
}
File pmdCsvReport = new File(basedir, "target/pmd.csv");
if (!pmdCsvReport.exists()) {
@@ -51,7 +54,3 @@ String textReport = readFile(pmdTextReport);
if (!textReport.contains(mainFile + ":5:\tUnusedLocalVariable")) {
throw new RuntimeException("Expected violation has not been reported in TXT");
}
if (!pmdXml.contains("<error filename=\"" + mainFile.getAbsolutePath()) || !pmdXml.contains(mainFile + "\" msg=\"PmdXPathException")) {
throw new RuntimeException("Processing error has not been reported");
}