@@ -91,7 +91,9 @@ protected void setUp() throws Exception {
9191 * Test CPDReport given the default configuration
9292 */
9393 public void testDefaultConfiguration () throws Exception {
94- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "default-configuration/cpd-default-configuration-plugin-config.xml" );
94+ File pluginXmlFile = new File (
95+ getBasedir (),
96+ "src/test/resources/unit/" + "default-configuration/cpd-default-configuration-plugin-config.xml" );
9597 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
9698 assertNotNull ("Mojo not found." , mojo1 );
9799
@@ -124,8 +126,7 @@ public void testDefaultConfiguration() throws Exception {
124126 File outputDir = mojo .getReportOutputDirectory ();
125127 String filename = mojo .getOutputPath () + ".html" ;
126128
127- File generatedReport =
128- new File (outputDir , filename );
129+ File generatedReport = new File (outputDir , filename );
129130 assertTrue (new File (generatedReport .getAbsolutePath ()).exists ());
130131
131132 // check if the CPD files were generated
@@ -144,7 +145,9 @@ public void testDefaultConfiguration() throws Exception {
144145 * Test CPDReport with the text renderer given as "format=txt"
145146 */
146147 public void testTxtFormat () throws Exception {
147- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "custom-configuration/cpd-txt-format-configuration-plugin-config.xml" );
148+ File pluginXmlFile = new File (
149+ getBasedir (),
150+ "src/test/resources/unit/" + "custom-configuration/cpd-txt-format-configuration-plugin-config.xml" );
148151 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
149152 assertNotNull ("Mojo not found." , mojo1 );
150153
@@ -174,9 +177,6 @@ public void testTxtFormat() throws Exception {
174177 ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest ();
175178 buildingRequest .setRepositorySession (lookup (LegacySupport .class ).getRepositorySession ());
176179
177- File outputDir = mojo .getReportOutputDirectory ();
178- String filename = mojo .getOutputPath () + ".html" ;
179-
180180 // check if the CPD files were generated
181181 File xmlFile = new File (getBasedir (), "target/test/unit/custom-configuration/target/cpd.xml" );
182182 assertTrue (new File (xmlFile .getAbsolutePath ()).exists ());
@@ -195,7 +195,9 @@ public void testTxtFormat() throws Exception {
195195 * Test CpdReport using custom configuration
196196 */
197197 public void testCustomConfiguration () throws Exception {
198- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "custom-configuration/cpd-custom-configuration-plugin-config.xml" );
198+ File pluginXmlFile = new File (
199+ getBasedir (),
200+ "src/test/resources/unit/" + "custom-configuration/cpd-custom-configuration-plugin-config.xml" );
199201 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
200202 assertNotNull ("Mojo not found." , mojo1 );
201203
@@ -228,8 +230,7 @@ public void testCustomConfiguration() throws Exception {
228230 File outputDir = mojo .getReportOutputDirectory ();
229231 String filename = mojo .getOutputPath () + ".html" ;
230232
231- File generatedReport =
232- new File (outputDir , filename );
233+ File generatedReport = new File (outputDir , filename );
233234 assertTrue (generatedReport .exists ());
234235
235236 // check if the CPD files were generated
@@ -284,9 +285,6 @@ public void testInvalidFormat() throws Exception {
284285 ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest ();
285286 buildingRequest .setRepositorySession (lookup (LegacySupport .class ).getRepositorySession ());
286287
287- File outputDir = mojo .getReportOutputDirectory ();
288- String filename = mojo .getOutputPath () + ".html" ;
289-
290288 // TODO this should be a more specific subclass
291289 fail ("RuntimeException must be thrown" );
292290 } catch (RuntimeException e ) {
@@ -295,7 +293,9 @@ public void testInvalidFormat() throws Exception {
295293 }
296294
297295 public void testWriteNonHtml () throws Exception {
298- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "default-configuration/cpd-default-configuration-plugin-config.xml" );
296+ File pluginXmlFile = new File (
297+ getBasedir (),
298+ "src/test/resources/unit/" + "default-configuration/cpd-default-configuration-plugin-config.xml" );
299299 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
300300 assertNotNull ("Mojo not found." , mojo1 );
301301
@@ -325,9 +325,6 @@ public void testWriteNonHtml() throws Exception {
325325 ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest ();
326326 buildingRequest .setRepositorySession (lookup (LegacySupport .class ).getRepositorySession ());
327327
328- File outputDir = mojo .getReportOutputDirectory ();
329- String filename = mojo .getOutputPath () + ".html" ;
330-
331328 // check if the CPD files were generated
332329 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
333330 assertTrue (generatedFile .exists ());
@@ -349,7 +346,9 @@ public void testWriteNonHtml() throws Exception {
349346 * @throws Exception
350347 */
351348 public void testIncludeXmlInReports () throws Exception {
352- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "default-configuration/cpd-report-include-xml-in-reports-config.xml" );
349+ File pluginXmlFile = new File (
350+ getBasedir (),
351+ "src/test/resources/unit/" + "default-configuration/cpd-report-include-xml-in-reports-config.xml" );
353352 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
354353 assertNotNull ("Mojo not found." , mojo1 );
355354
@@ -379,9 +378,6 @@ public void testIncludeXmlInReports() throws Exception {
379378 ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest ();
380379 buildingRequest .setRepositorySession (lookup (LegacySupport .class ).getRepositorySession ());
381380
382- File outputDir = mojo .getReportOutputDirectory ();
383- String filename = mojo .getOutputPath () + ".html" ;
384-
385381 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
386382 assertTrue (generatedFile .exists ());
387383
@@ -401,7 +397,8 @@ public void testIncludeXmlInReports() throws Exception {
401397
402398 public void testSkipEmptyReportConfiguration () throws Exception {
403399 // verify the generated files do not exist because PMD was skipped
404- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "empty-report/cpd-skip-empty-report-plugin-config.xml" );
400+ File pluginXmlFile = new File (
401+ getBasedir (), "src/test/resources/unit/" + "empty-report/cpd-skip-empty-report-plugin-config.xml" );
405402 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
406403 assertNotNull ("Mojo not found." , mojo1 );
407404
@@ -440,7 +437,8 @@ public void testSkipEmptyReportConfiguration() throws Exception {
440437
441438 public void testEmptyReportConfiguration () throws Exception {
442439 // verify the generated files do exist, even if there are no violations
443- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "empty-report/cpd-empty-report-plugin-config.xml" );
440+ File pluginXmlFile =
441+ new File (getBasedir (), "src/test/resources/unit/" + "empty-report/cpd-empty-report-plugin-config.xml" );
444442 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
445443 assertNotNull ("Mojo not found." , mojo1 );
446444
@@ -488,7 +486,9 @@ public void testCpdEncodingConfiguration() throws Exception {
488486 try {
489487 System .setProperty ("file.encoding" , "UTF-16" );
490488
491- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "default-configuration/cpd-default-configuration-plugin-config.xml" );
489+ File pluginXmlFile = new File (
490+ getBasedir (),
491+ "src/test/resources/unit/" + "default-configuration/cpd-default-configuration-plugin-config.xml" );
492492 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
493493 assertNotNull ("Mojo not found." , mojo1 );
494494
@@ -518,9 +518,6 @@ public void testCpdEncodingConfiguration() throws Exception {
518518 ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest ();
519519 buildingRequest .setRepositorySession (lookup (LegacySupport .class ).getRepositorySession ());
520520
521- File outputDir = mojo .getReportOutputDirectory ();
522- String filename = mojo .getOutputPath () + ".html" ;
523-
524521 // check if the CPD files were generated
525522 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
526523 assertTrue (generatedFile .exists ());
@@ -532,7 +529,8 @@ public void testCpdEncodingConfiguration() throws Exception {
532529 }
533530
534531 public void testCpdJavascriptConfiguration () throws Exception {
535- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "default-configuration/cpd-javascript-plugin-config.xml" );
532+ File pluginXmlFile = new File (
533+ getBasedir (), "src/test/resources/unit/" + "default-configuration/cpd-javascript-plugin-config.xml" );
536534 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
537535 assertNotNull ("Mojo not found." , mojo1 );
538536
@@ -562,9 +560,6 @@ public void testCpdJavascriptConfiguration() throws Exception {
562560 ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest ();
563561 buildingRequest .setRepositorySession (lookup (LegacySupport .class ).getRepositorySession ());
564562
565- File outputDir = mojo .getReportOutputDirectory ();
566- String filename = mojo .getOutputPath () + ".html" ;
567-
568563 // verify the generated file exists and violations are reported
569564 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
570565 assertTrue (generatedFile .exists ());
@@ -574,7 +569,8 @@ public void testCpdJavascriptConfiguration() throws Exception {
574569 }
575570
576571 public void testCpdJspConfiguration () throws Exception {
577- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "default-configuration/cpd-jsp-plugin-config.xml" );
572+ File pluginXmlFile =
573+ new File (getBasedir (), "src/test/resources/unit/" + "default-configuration/cpd-jsp-plugin-config.xml" );
578574 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
579575 assertNotNull ("Mojo not found." , mojo1 );
580576
@@ -604,9 +600,6 @@ public void testCpdJspConfiguration() throws Exception {
604600 ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest ();
605601 buildingRequest .setRepositorySession (lookup (LegacySupport .class ).getRepositorySession ());
606602
607- File outputDir = mojo .getReportOutputDirectory ();
608- String filename = mojo .getOutputPath () + ".html" ;
609-
610603 // verify the generated file exists and violations are reported
611604 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
612605 assertTrue (generatedFile .exists ());
@@ -616,7 +609,10 @@ public void testCpdJspConfiguration() throws Exception {
616609 }
617610
618611 public void testExclusionsConfiguration () throws Exception {
619- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml" );
612+ File pluginXmlFile = new File (
613+ getBasedir (),
614+ "src/test/resources/unit/"
615+ + "default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml" );
620616 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
621617 assertNotNull ("Mojo not found." , mojo1 );
622618
@@ -646,9 +642,6 @@ public void testExclusionsConfiguration() throws Exception {
646642 ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest ();
647643 buildingRequest .setRepositorySession (lookup (LegacySupport .class ).getRepositorySession ());
648644
649- File outputDir = mojo .getReportOutputDirectory ();
650- String filename = mojo .getOutputPath () + ".html" ;
651-
652645 // verify the generated file exists and no duplications are reported
653646 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
654647 assertTrue (generatedFile .exists ());
@@ -658,7 +651,8 @@ public void testExclusionsConfiguration() throws Exception {
658651
659652 public void testWithCpdErrors () throws Exception {
660653 try {
661- File pluginXmlFile = new File (getBasedir (), "src/test/resources/unit/" + "CpdReportTest/with-cpd-errors/pom.xml" );
654+ File pluginXmlFile =
655+ new File (getBasedir (), "src/test/resources/unit/" + "CpdReportTest/with-cpd-errors/pom.xml" );
662656 AbstractPmdReport mojo1 = lookupMojo ("cpd" , pluginXmlFile );
663657 assertNotNull ("Mojo not found." , mojo1 );
664658
@@ -688,9 +682,6 @@ public void testWithCpdErrors() throws Exception {
688682 ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest ();
689683 buildingRequest .setRepositorySession (lookup (LegacySupport .class ).getRepositorySession ());
690684
691- File outputDir = mojo .getReportOutputDirectory ();
692- String filename = mojo .getOutputPath () + ".html" ;
693-
694685 fail ("MojoExecutionException must be thrown" );
695686 } catch (MojoExecutionException e ) {
696687 assertMavenReportException ("There was 1 error while executing CPD" , e );
0 commit comments