Fix merge

This commit is contained in:
Clément Fournier 2023-02-26 16:23:12 +01:00
parent 65725c13aa
commit bf2c69921e
No known key found for this signature in database
GPG Key ID: 4D8D42402E4F47E2

View File

@ -4,6 +4,7 @@
package net.sourceforge.pmd.it; package net.sourceforge.pmd.it;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File; import java.io.File;
@ -25,7 +26,7 @@ class AnalysisCacheIT extends AbstractBinaryDistributionTest {
// Ensure we have violations and a non-empty cache file // Ensure we have violations and a non-empty cache file
assertTrue(cacheFile.toFile().length() > 0, "cache file is empty after run"); assertTrue(cacheFile.toFile().length() > 0, "cache file is empty after run");
result.assertExecutionResult(4, "", srcDir + File.separator + "JumbledIncrementer.java:8:\tJumbledIncrementer:\t"); result.assertExitCode(4).assertReport(containsString(srcDir + File.separator + "JumbledIncrementer.java:8:\tJumbledIncrementer:\t"));
// rerun from cache // rerun from cache
ExecutionResult resultFromCache = PMDExecutor.runPMD(createTemporaryReportFile(), tempDir, "-d", srcDir, "-R", "src/test/resources/rulesets/sample-ruleset.xml", ExecutionResult resultFromCache = PMDExecutor.runPMD(createTemporaryReportFile(), tempDir, "-d", srcDir, "-R", "src/test/resources/rulesets/sample-ruleset.xml",
@ -45,7 +46,8 @@ class AnalysisCacheIT extends AbstractBinaryDistributionTest {
// Ensure we have violations and a non-empty cache file // Ensure we have violations and a non-empty cache file
assertTrue(cacheFile.toFile().length() > 0, "cache file is empty after run"); assertTrue(cacheFile.toFile().length() > 0, "cache file is empty after run");
result.assertExecutionResult(4, "", srcDir + File.separator + "JumbledIncrementer.java:8:\tJumbledIncrementer:\t"); result.assertExitCode(4)
.assertReport(containsString(srcDir + File.separator + "JumbledIncrementer.java:8:\tJumbledIncrementer:\t"));
// rerun from cache with relativized paths // rerun from cache with relativized paths
ExecutionResult resultFromCache = PMDExecutor.runPMD(createTemporaryReportFile(), tempDir, "-d", Paths.get(".").toAbsolutePath().relativize(Paths.get(srcDir)).toString(), "-R", "src/test/resources/rulesets/sample-ruleset.xml", ExecutionResult resultFromCache = PMDExecutor.runPMD(createTemporaryReportFile(), tempDir, "-d", Paths.get(".").toAbsolutePath().relativize(Paths.get(srcDir)).toString(), "-R", "src/test/resources/rulesets/sample-ruleset.xml",
@ -54,7 +56,8 @@ class AnalysisCacheIT extends AbstractBinaryDistributionTest {
resultFromCache.assertErrorOutputContains("Incremental Analysis cache HIT"); resultFromCache.assertErrorOutputContains("Incremental Analysis cache HIT");
// An error with the relative path should exist, but no with the absolute one // An error with the relative path should exist, but no with the absolute one
resultFromCache.assertExecutionResult(4, "", "src/test/resources/sample-source/java/JumbledIncrementer.java:8:\tJumbledIncrementer:\t".replace('/', File.separatorChar)); result.assertExitCode(4)
.assertReport(containsString("src/test/resources/sample-source/java/JumbledIncrementer.java:8:\tJumbledIncrementer:\t".replace('/', File.separatorChar)));
resultFromCache.assertNoErrorInReport(srcDir + File.separator + "JumbledIncrementer.java:8:\tJumbledIncrementer:\t"); resultFromCache.assertNoErrorInReport(srcDir + File.separator + "JumbledIncrementer.java:8:\tJumbledIncrementer:\t");
} }
} }