Skip to content

Commit d1aec02

Browse files
committed
[SUREFIRE-2161] Align Mojo class names and output names
1 parent 988e1ed commit d1aec02

File tree

22 files changed

+61
-62
lines changed

22 files changed

+61
-62
lines changed

maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@
162162
* Abstract base class for running tests using Surefire.
163163
*
164164
* @author Stephen Connolly
165-
* @version $Id: SurefirePlugin.java 945065 2010-05-17 10:26:22Z stephenc $
166165
*/
167166
public abstract class AbstractSurefireMojo extends AbstractMojo implements SurefireExecutionParameters {
168167
private static final Map<String, String> JAVA_9_MATCHER_OLD_NOTATION = singletonMap("version", "[1.9,)");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
defaultPhase = LifecyclePhase.TEST,
4646
threadSafe = true,
4747
requiresDependencyResolution = ResolutionScope.TEST)
48-
public class SurefirePlugin extends AbstractSurefireMojo implements SurefireReportParameters {
48+
public class SurefireMojo extends AbstractSurefireMojo implements SurefireReportParameters {
4949

5050
/**
5151
* The directory containing generated classes of the project being tested. This will be included after the test
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,26 @@
3131
/**
3232
*
3333
*/
34-
public class SurefirePluginTest extends TestCase {
34+
public class SurefireMojoTest extends TestCase {
3535
@Rule
3636
public final ExpectedException e = ExpectedException.none();
3737

3838
public void testDefaultIncludes() {
39-
assertThat(new SurefirePlugin().getDefaultIncludes())
39+
assertThat(new SurefireMojo().getDefaultIncludes())
4040
.containsOnly("**/Test*.java", "**/*Test.java", "**/*Tests.java", "**/*TestCase.java");
4141
}
4242

4343
public void testReportSchemaLocation() {
44-
assertThat(new SurefirePlugin().getReportSchemaLocation())
44+
assertThat(new SurefireMojo().getReportSchemaLocation())
4545
.isEqualTo("https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd");
4646
}
4747

4848
public void testFailIfNoTests() throws Exception {
4949
RunResult runResult = new RunResult(0, 0, 0, 0);
5050
try {
51-
SurefirePlugin plugin = new SurefirePlugin();
52-
plugin.setFailIfNoTests(true);
53-
plugin.handleSummary(runResult, null);
51+
SurefireMojo mojo = new SurefireMojo();
52+
mojo.setFailIfNoTests(true);
53+
mojo.handleSummary(runResult, null);
5454
} catch (MojoFailureException e) {
5555
assertThat(e.getLocalizedMessage())
5656
.isEqualTo("No tests were executed! (Set -DfailIfNoTests=false to ignore this error.)");
@@ -63,8 +63,8 @@ public void testFailIfNoTests() throws Exception {
6363
public void testTestFailure() throws Exception {
6464
RunResult runResult = new RunResult(1, 0, 1, 0);
6565
try {
66-
SurefirePlugin plugin = new SurefirePlugin();
67-
plugin.handleSummary(runResult, null);
66+
SurefireMojo mojo = new SurefireMojo();
67+
mojo.handleSummary(runResult, null);
6868
} catch (MojoFailureException e) {
6969
assertThat(e.getLocalizedMessage())
7070
.isEqualTo("There are test failures.\n\nPlease refer to null "
@@ -79,47 +79,47 @@ public void testTestFailure() throws Exception {
7979
}
8080

8181
public void testPluginName() {
82-
assertThat(new SurefirePlugin().getPluginName()).isEqualTo("surefire");
82+
assertThat(new SurefireMojo().getPluginName()).isEqualTo("surefire");
8383
}
8484

8585
public void testShouldGetNullEnv() {
86-
SurefirePlugin plugin = new SurefirePlugin();
87-
assertThat(plugin.getExcludedEnvironmentVariables()).hasSize(0);
86+
SurefireMojo mojo = new SurefireMojo();
87+
assertThat(mojo.getExcludedEnvironmentVariables()).hasSize(0);
8888
}
8989

9090
public void testShouldGetEnv() {
91-
SurefirePlugin plugin = new SurefirePlugin();
92-
plugin.setExcludedEnvironmentVariables(new String[] {"ABC", "KLM"});
93-
assertThat(plugin.getExcludedEnvironmentVariables()).hasSize(2).contains("ABC", "KLM");
91+
SurefireMojo mojo = new SurefireMojo();
92+
mojo.setExcludedEnvironmentVariables(new String[] {"ABC", "KLM"});
93+
assertThat(mojo.getExcludedEnvironmentVariables()).hasSize(2).contains("ABC", "KLM");
9494
}
9595

9696
public void testShouldGetPropertyFile() {
97-
SurefirePlugin plugin = new SurefirePlugin();
98-
plugin.setSystemPropertiesFile(new File("testShouldGetPropertyFile"));
99-
assertThat(plugin.getSystemPropertiesFile()).isEqualTo(new File("testShouldGetPropertyFile"));
97+
SurefireMojo mojo = new SurefireMojo();
98+
mojo.setSystemPropertiesFile(new File("testShouldGetPropertyFile"));
99+
assertThat(mojo.getSystemPropertiesFile()).isEqualTo(new File("testShouldGetPropertyFile"));
100100
}
101101

102102
public void testNegativeFailOnFlakeCount() {
103-
SurefirePlugin plugin = new SurefirePlugin();
104-
plugin.setFailOnFlakeCount(-1);
103+
SurefireMojo mojo = new SurefireMojo();
104+
mojo.setFailOnFlakeCount(-1);
105105
e.expect(MojoFailureException.class);
106106
e.expectMessage("Parameter \"failOnFlakeCount\" should not be negative.");
107107
}
108108

109109
public void testFailOnFlakeCountWithoutRerun() {
110-
SurefirePlugin plugin = new SurefirePlugin();
111-
plugin.setFailOnFlakeCount(1);
110+
SurefireMojo mojo = new SurefireMojo();
111+
mojo.setFailOnFlakeCount(1);
112112
e.expect(MojoFailureException.class);
113113
e.expectMessage("\"failOnFlakeCount\" requires rerunFailingTestsCount to be at least 1.");
114114
}
115115

116116
public void testShouldHaveJUnit5EnginesFilter() {
117-
SurefirePlugin plugin = new SurefirePlugin();
117+
SurefireMojo mojo = new SurefireMojo();
118118

119-
plugin.setIncludeJUnit5Engines(new String[] {"e1", "e2"});
120-
assertThat(plugin.getIncludeJUnit5Engines()).isEqualTo(new String[] {"e1", "e2"});
119+
mojo.setIncludeJUnit5Engines(new String[] {"e1", "e2"});
120+
assertThat(mojo.getIncludeJUnit5Engines()).isEqualTo(new String[] {"e1", "e2"});
121121

122-
plugin.setExcludeJUnit5Engines(new String[] {"e1", "e2"});
123-
assertThat(plugin.getExcludeJUnit5Engines()).isEqualTo(new String[] {"e1", "e2"});
122+
mojo.setExcludeJUnit5Engines(new String[] {"e1", "e2"});
123+
assertThat(mojo.getExcludeJUnit5Engines()).isEqualTo(new String[] {"e1", "e2"});
124124
}
125125
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
*
5656
* @author Stephen Connolly
5757
*/
58-
public abstract class AbstractSurefireReportMojo extends AbstractMavenReport {
58+
public abstract class AbstractSurefireReport extends AbstractMavenReport {
5959

6060
/**
6161
* If set to false, only failures are shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
*/
3636
@Mojo(name = "failsafe-report-only")
3737
@SuppressWarnings("unused")
38-
public class FailsafeReportMojo extends AbstractSurefireReportMojo {
38+
public class FailsafeOnlyReport extends AbstractSurefireReport {
3939

4040
/**
4141
* The filename to use for the report.
4242
*/
43-
@Parameter(defaultValue = "failsafe-report", property = "outputName", required = true)
43+
@Parameter(defaultValue = "failsafe", property = "outputName", required = true)
4444
private String outputName;
4545

4646
/**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
@Mojo(name = "report-only")
3535
@Execute(phase = LifecyclePhase.NONE)
3636
@SuppressWarnings("unused")
37-
public class SurefireReportOnlyMojo extends SurefireReportMojo {}
37+
public class SurefireOnlyReport extends SurefireReport {}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
@Mojo(name = "report", inheritByDefault = false)
3535
@Execute(lifecycle = "surefire", phase = LifecyclePhase.TEST)
3636
@SuppressWarnings("unused")
37-
public class SurefireReportMojo extends AbstractSurefireReportMojo {
37+
public class SurefireReport extends AbstractSurefireReport {
3838

3939
/**
4040
* The filename to use for the report.
4141
*/
42-
@Parameter(defaultValue = "surefire-report", property = "outputName", required = true)
42+
@Parameter(defaultValue = "surefire", property = "outputName", required = true)
4343
private String outputName;
4444

4545
/**

maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/JUnit4SuiteTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static Test suite() {
3434
TestSuite suite = new TestSuite();
3535
suite.addTest(new JUnit4TestAdapter(Surefire597Test.class));
3636
suite.addTest(new JUnit4TestAdapter(SurefireSchemaValidationTest.class));
37-
suite.addTestSuite(SurefireReportMojoTest.class);
37+
suite.addTestSuite(SurefireReportTest.class);
3838
return suite;
3939
}
4040
}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* @author <a href="mailto:[email protected]">Allan Ramirez</a>
4343
*/
4444
@SuppressWarnings("checkstyle:linelength")
45-
public class SurefireReportMojoTest extends AbstractMojoTestCase {
45+
public class SurefireReportTest extends AbstractMojoTestCase {
4646
private ArtifactStubFactory artifactStubFactory;
4747

4848
// Can be removed with Doxia 2.0.0
@@ -64,8 +64,8 @@ protected void tearDown() throws Exception {
6464
super.tearDown();
6565
}
6666

67-
protected SurefireReportMojo createReportMojo(File pluginXmlFile) throws Exception {
68-
SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo("report", pluginXmlFile);
67+
protected SurefireReport createReportMojo(File pluginXmlFile) throws Exception {
68+
SurefireReport mojo = (SurefireReport) lookupMojo("report", pluginXmlFile);
6969
assertNotNull("Mojo found.", mojo);
7070

7171
LegacySupport legacySupport = lookup(LegacySupport.class);
@@ -82,7 +82,7 @@ protected SurefireReportMojo createReportMojo(File pluginXmlFile) throws Excepti
8282

8383
public void testBasicSurefireReport() throws Exception {
8484
File testPom = new File(getUnitBaseDir(), "basic-surefire-report-test/plugin-config.xml");
85-
SurefireReportMojo mojo = createReportMojo(testPom);
85+
SurefireReport mojo = createReportMojo(testPom);
8686
File outputDir = (File) getVariableValueFromObject(mojo, "outputDirectory");
8787
boolean showSuccess = (Boolean) getVariableValueFromObject(mojo, "showSuccess");
8888
File reportsDir = (File) getVariableValueFromObject(mojo, "reportsDirectory");
@@ -119,7 +119,7 @@ private File getUnitBaseDir() throws UnsupportedEncodingException {
119119

120120
public void testBasicSurefireReportIfShowSuccessIsFalse() throws Exception {
121121
File testPom = new File(getUnitBaseDir(), "basic-surefire-report-success-false/plugin-config.xml");
122-
SurefireReportMojo mojo = createReportMojo(testPom);
122+
SurefireReport mojo = createReportMojo(testPom);
123123
boolean showSuccess = (Boolean) getVariableValueFromObject(mojo, "showSuccess");
124124
assertFalse(showSuccess);
125125
mojo.execute();
@@ -134,7 +134,7 @@ public void testBasicSurefireReportIfShowSuccessIsFalse() throws Exception {
134134

135135
public void testBasicSurefireReportIfLinkXrefIsFalse() throws Exception {
136136
File testPom = new File(getUnitBaseDir(), "basic-surefire-report-linkxref-false/plugin-config.xml");
137-
SurefireReportMojo mojo = createReportMojo(testPom);
137+
SurefireReport mojo = createReportMojo(testPom);
138138
boolean linkXRef = (Boolean) getVariableValueFromObject(mojo, "linkXRef");
139139
assertFalse(linkXRef);
140140
mojo.execute();
@@ -149,7 +149,7 @@ public void testBasicSurefireReportIfLinkXrefIsFalse() throws Exception {
149149

150150
public void testBasicSurefireReportIfReportingIsNull() throws Exception {
151151
File testPom = new File(getUnitBaseDir(), "basic-surefire-report-reporting-null/plugin-config.xml");
152-
SurefireReportMojo mojo = createReportMojo(testPom);
152+
SurefireReport mojo = createReportMojo(testPom);
153153
mojo.execute();
154154
File report =
155155
new File(getBasedir(), "target/site/unit/basic-surefire-report-reporting-null/surefire-report.html");
@@ -163,7 +163,7 @@ public void testBasicSurefireReportIfReportingIsNull() throws Exception {
163163
@SuppressWarnings("checkstyle:methodname")
164164
public void testBasicSurefireReport_AnchorTestCases() throws Exception {
165165
File testPom = new File(getUnitBaseDir(), "basic-surefire-report-anchor-test-cases/plugin-config.xml");
166-
SurefireReportMojo mojo = createReportMojo(testPom);
166+
SurefireReport mojo = createReportMojo(testPom);
167167
mojo.execute();
168168
File report =
169169
new File(getBasedir(), "target/site/unit/basic-surefire-report-anchor-test-cases/surefire-report.html");
@@ -180,7 +180,7 @@ public void testBasicSurefireReport_AnchorTestCases() throws Exception {
180180

181181
public void testSurefireReportSingleError() throws Exception {
182182
File testPom = new File(getUnitBaseDir(), "surefire-report-single-error/plugin-config.xml");
183-
SurefireReportMojo mojo = createReportMojo(testPom);
183+
SurefireReport mojo = createReportMojo(testPom);
184184
mojo.execute();
185185
File report = new File(getBasedir(), "target/site/unit/surefire-report-single-error/surefire-report.html");
186186
assertTrue(report.exists());
@@ -267,7 +267,7 @@ public void testSurefireReportSingleError() throws Exception {
267267

268268
public void testSurefireReportNestedClassTrimStackTrace() throws Exception {
269269
File testPom = new File(getUnitBaseDir(), "surefire-report-nestedClass-trimStackTrace/plugin-config.xml");
270-
SurefireReportMojo mojo = createReportMojo(testPom);
270+
SurefireReport mojo = createReportMojo(testPom);
271271
mojo.execute();
272272
File report = new File(
273273
getBasedir(), "target/site/unit/surefire-report-nestedClass-trimStackTrace/surefire-report.html");
@@ -331,7 +331,7 @@ public void testSurefireReportNestedClassTrimStackTrace() throws Exception {
331331

332332
public void testSurefireReportNestedClass() throws Exception {
333333
File testPom = new File(getUnitBaseDir(), "surefire-report-nestedClass/plugin-config.xml");
334-
SurefireReportMojo mojo = createReportMojo(testPom);
334+
SurefireReport mojo = createReportMojo(testPom);
335335
mojo.execute();
336336
File report = new File(getBasedir(), "target/site/unit/surefire-report-nestedClass/surefire-report.html");
337337
assertTrue(report.exists());
@@ -418,7 +418,7 @@ public void testSurefireReportNestedClass() throws Exception {
418418

419419
public void testSurefireReportEnclosedTrimStackTrace() throws Exception {
420420
File testPom = new File(getUnitBaseDir(), "surefire-report-enclosed-trimStackTrace/plugin-config.xml");
421-
SurefireReportMojo mojo = createReportMojo(testPom);
421+
SurefireReport mojo = createReportMojo(testPom);
422422
mojo.execute();
423423
File report =
424424
new File(getBasedir(), "target/site/unit/surefire-report-enclosed-trimStackTrace/surefire-report.html");
@@ -482,7 +482,7 @@ public void testSurefireReportEnclosedTrimStackTrace() throws Exception {
482482

483483
public void testSurefireReportEnclosed() throws Exception {
484484
File testPom = new File(getUnitBaseDir(), "surefire-report-enclosed/plugin-config.xml");
485-
SurefireReportMojo mojo = createReportMojo(testPom);
485+
SurefireReport mojo = createReportMojo(testPom);
486486
mojo.execute();
487487
File report = new File(getBasedir(), "target/site/unit/surefire-report-enclosed/surefire-report.html");
488488
assertTrue(report.exists());
@@ -579,7 +579,7 @@ public void testSurefireReportEnclosed() throws Exception {
579579

580580
public void testCustomTitleAndDescriptionReport() throws Exception {
581581
File testPom = new File(getUnitBaseDir(), "surefire-1183/plugin-config.xml");
582-
SurefireReportMojo mojo = createReportMojo(testPom);
582+
SurefireReport mojo = createReportMojo(testPom);
583583

584584
File outputDir = (File) getVariableValueFromObject(mojo, "outputDirectory");
585585
String outputName = (String) getVariableValueFromObject(mojo, "outputName");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/**
3434
* @author <a href="mailto:[email protected]">Allan Ramirez</a>
3535
*/
36-
public class SurefireRepMavenProjectStub extends MavenProjectStub {
36+
public class SurefireReportMavenProjectStub extends MavenProjectStub {
3737
/**
3838
* {@inheritDoc}
3939
*/

0 commit comments

Comments
 (0)