diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleTestCase.java b/src/test/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleTestCase.java index 49657095..d9d72381 100644 --- a/src/test/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleTestCase.java +++ b/src/test/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleTestCase.java @@ -140,7 +140,9 @@ protected File generateReport(CheckstyleReport mojo, File pluginXmlFile) throws File outputDir = mojo.getReportOutputDirectory(); String filename = mojo.getOutputName() + ".html"; - return new File(outputDir, filename); + File file = new File(outputDir, filename); + + return file; } /** diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleReportTest.java b/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleReportTest.java index 61f673db..a3bc4908 100644 --- a/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleReportTest.java +++ b/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleReportTest.java @@ -34,6 +34,7 @@ public class CheckstyleReportTest extends AbstractCheckstyleTestCase { public void testNoSource() throws Exception { File generatedReport = generateReport(getGoal(), "no-source-plugin-config.xml"); assertTrue(new File(generatedReport.getAbsolutePath()).exists()); + generatedReport.delete(); } public void testMinConfiguration() throws Exception { @@ -112,8 +113,6 @@ private void generateReport(String pluginXml) throws Exception { assertTrue("Test cache file exists", new File(cacheFile).exists()); } - File outputDir = mojo.getReportOutputDirectory(); - File useFile = (File) getVariableValueFromObject(mojo, "useFile"); if (useFile != null) { assertTrue("Test useFile exists", useFile.exists()); diff --git a/src/test/resources/plugin-configs/test-source-directory-plugin-config.xml b/src/test/resources/plugin-configs/test-source-directory-plugin-config.xml index 79cf03a1..3a2ee5ca 100644 --- a/src/test/resources/plugin-configs/test-source-directory-plugin-config.xml +++ b/src/test/resources/plugin-configs/test-source-directory-plugin-config.xml @@ -27,15 +27,15 @@ under the License. maven-checkstyle-plugin - ${basedir}/target/test-harness/checkstyle/no-source + ${basedir}/target/test-harness/checkstyle/test-source-directory true true true **/*.java sun_checks.xml ${basedir}/src/test/test-sources/LICENSE.txt - ${basedir}/target/test-harness/checkstyle/no-source/checkstyle-cachefile - ${basedir}/target/test-harness/checkstyle/no-source/checkstyle-result.xml + ${basedir}/target/test-harness/checkstyle/test-source-directory/checkstyle-cachefile + ${basedir}/target/test-harness/checkstyle/test-source-directory/checkstyle-result.xml xml false