@@ -92,7 +92,7 @@ protected void setUp() throws Exception {
9292 */
9393 public void testDefaultConfiguration () throws Exception {
9494 File generatedReport =
95- generateReport (getGoal () , "default-configuration/cpd-default-configuration-plugin-config.xml" );
95+ generateReport ("cpd" , "default-configuration/cpd-default-configuration-plugin-config.xml" );
9696 assertTrue (new File (generatedReport .getAbsolutePath ()).exists ());
9797
9898 // check if the CPD files were generated
@@ -111,7 +111,7 @@ public void testDefaultConfiguration() throws Exception {
111111 * Test CPDReport with the text renderer given as "format=txt"
112112 */
113113 public void testTxtFormat () throws Exception {
114- generateReport (getGoal () , "custom-configuration/cpd-txt-format-configuration-plugin-config.xml" );
114+ generateReport ("cpd" , "custom-configuration/cpd-txt-format-configuration-plugin-config.xml" );
115115
116116 // check if the CPD files were generated
117117 File xmlFile = new File (getBasedir (), "target/test/unit/custom-configuration/target/cpd.xml" );
@@ -132,7 +132,7 @@ public void testTxtFormat() throws Exception {
132132 */
133133 public void testCustomConfiguration () throws Exception {
134134 File generatedReport =
135- generateReport (getGoal () , "custom-configuration/cpd-custom-configuration-plugin-config.xml" );
135+ generateReport ("cpd" , "custom-configuration/cpd-custom-configuration-plugin-config.xml" );
136136 assertTrue (generatedReport .exists ());
137137
138138 // check if the CPD files were generated
@@ -156,7 +156,7 @@ public void testInvalidFormat() throws Exception {
156156 try {
157157 File testPom = new File (
158158 getBasedir (), "src/test/resources/unit/invalid-format/cpd-invalid-format-plugin-config.xml" );
159- AbstractPmdReport mojo = createReportMojo (getGoal () , testPom );
159+ AbstractPmdReport mojo = createReportMojo ("cpd" , testPom );
160160 setVariableValueToObject (
161161 mojo , "compileSourceRoots" , mojo .getProject ().getCompileSourceRoots ());
162162 generateReport (mojo , testPom );
@@ -169,7 +169,7 @@ public void testInvalidFormat() throws Exception {
169169 }
170170
171171 public void testWriteNonHtml () throws Exception {
172- generateReport (getGoal () , "default-configuration/cpd-default-configuration-plugin-config.xml" );
172+ generateReport ("cpd" , "default-configuration/cpd-default-configuration-plugin-config.xml" );
173173
174174 // check if the CPD files were generated
175175 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
@@ -192,7 +192,7 @@ public void testWriteNonHtml() throws Exception {
192192 * @throws Exception
193193 */
194194 public void testIncludeXmlInReports () throws Exception {
195- generateReport (getGoal () , "default-configuration/cpd-report-include-xml-in-reports-config.xml" );
195+ generateReport ("cpd" , "default-configuration/cpd-report-include-xml-in-reports-config.xml" );
196196
197197 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
198198 assertTrue (generatedFile .exists ());
@@ -213,13 +213,13 @@ public void testIncludeXmlInReports() throws Exception {
213213
214214 public void testSkipEmptyReportConfiguration () throws Exception {
215215 // verify the generated files do not exist because PMD was skipped
216- File generatedReport = generateReport (getGoal () , "empty-report/cpd-skip-empty-report-plugin-config.xml" );
216+ File generatedReport = generateReport ("cpd" , "empty-report/cpd-skip-empty-report-plugin-config.xml" );
217217 assertFalse (new File (generatedReport .getAbsolutePath ()).exists ());
218218 }
219219
220220 public void testEmptyReportConfiguration () throws Exception {
221221 // verify the generated files do exist, even if there are no violations
222- File generatedReport = generateReport (getGoal () , "empty-report/cpd-empty-report-plugin-config.xml" );
222+ File generatedReport = generateReport ("cpd" , "empty-report/cpd-empty-report-plugin-config.xml" );
223223 assertTrue (
224224 generatedReport .getAbsolutePath () + " does not exist" ,
225225 new File (generatedReport .getAbsolutePath ()).exists ());
@@ -234,7 +234,7 @@ public void testCpdEncodingConfiguration() throws Exception {
234234 try {
235235 System .setProperty ("file.encoding" , "UTF-16" );
236236
237- generateReport (getGoal () , "default-configuration/cpd-default-configuration-plugin-config.xml" );
237+ generateReport ("cpd" , "default-configuration/cpd-default-configuration-plugin-config.xml" );
238238
239239 // check if the CPD files were generated
240240 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
@@ -247,7 +247,7 @@ public void testCpdEncodingConfiguration() throws Exception {
247247 }
248248
249249 public void testCpdJavascriptConfiguration () throws Exception {
250- generateReport (getGoal () , "default-configuration/cpd-javascript-plugin-config.xml" );
250+ generateReport ("cpd" , "default-configuration/cpd-javascript-plugin-config.xml" );
251251
252252 // verify the generated file exists and violations are reported
253253 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
@@ -258,7 +258,7 @@ public void testCpdJavascriptConfiguration() throws Exception {
258258 }
259259
260260 public void testCpdJspConfiguration () throws Exception {
261- generateReport (getGoal () , "default-configuration/cpd-jsp-plugin-config.xml" );
261+ generateReport ("cpd" , "default-configuration/cpd-jsp-plugin-config.xml" );
262262
263263 // verify the generated file exists and violations are reported
264264 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
@@ -269,7 +269,7 @@ public void testCpdJspConfiguration() throws Exception {
269269 }
270270
271271 public void testExclusionsConfiguration () throws Exception {
272- generateReport (getGoal () , "default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml" );
272+ generateReport ("cpd" , "default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml" );
273273
274274 // verify the generated file exists and no duplications are reported
275275 File generatedFile = new File (getBasedir (), "target/test/unit/default-configuration/target/cpd.xml" );
@@ -280,7 +280,7 @@ public void testExclusionsConfiguration() throws Exception {
280280
281281 public void testWithCpdErrors () throws Exception {
282282 try {
283- generateReport (getGoal () , "CpdReportTest/with-cpd-errors/pom.xml" );
283+ generateReport ("cpd" , "CpdReportTest/with-cpd-errors/pom.xml" );
284284
285285 fail ("MojoExecutionException must be thrown" );
286286 } catch (MojoExecutionException e ) {
@@ -306,10 +306,6 @@ private static void assertReportContains(String expectedMessage) throws IOExcept
306306 "Expected '" + expectedMessage + "' in cpd.xml, but was:\n " + report , report .contains (expectedMessage ));
307307 }
308308
309- protected String getGoal () {
310- return "cpd" ;
311- }
312-
313309 @ Override
314310 protected void tearDown () throws Exception {
315311 SessionScope lookup = lookup (SessionScope .class );
@@ -379,7 +375,7 @@ protected String readFile(File file) throws IOException {
379375
380376 private MojoExecution getMockMojoExecution () {
381377 MojoDescriptor mojoDescriptor = new MojoDescriptor ();
382- mojoDescriptor .setGoal (getGoal () );
378+ mojoDescriptor .setGoal ("cpd" );
383379
384380 MojoExecution execution = new MojoExecution (mojoDescriptor );
385381
0 commit comments