Tibor17 commented on a change in pull request #344:
URL: https://github.com/apache/maven-surefire/pull/344#discussion_r606320356



##########
File path: 
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -501,6 +504,12 @@
     @Parameter( property = "excludedGroups" )
     private String excludedGroups;
 
+    @Parameter( property = "junitIncludeEngine" )

Review comment:
       yes, the trick is called an Abstcation.
   
   Let's jump to the class `SurefirePlugin`, and consider the field 
[printSummary](https://github.com/apache/maven-surefire/blob/master/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java#L100)
 and its 
[setter](https://github.com/apache/maven-surefire/blob/master/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java#L702)
 and 
[getter](https://github.com/apache/maven-surefire/blob/master/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java#L696).
   
   Now jump to the class `IntegrationTestMojo`. The field with name 
[printSummary](https://github.com/apache/maven-surefire/blob/master/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java#L117),
 
[setter](https://github.com/apache/maven-surefire/blob/master/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java#L692)
 and 
[getter](https://github.com/apache/maven-surefire/blob/master/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java#L686).
   
   These were concrete implementations. But notice that both classes implement 
the same interface through extension of the abstract class 
`AbstractSurefireMojo`, see 
[this](https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L162).
 So the 
[interface](https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java)
 declares abstract methods I spoke before, the 
[setter](https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java#L83)
 and 
[getter](https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java#L81).
   
   The task for you is to rename your fields to `includeJUnit5Engines` and 
`excludeJUnit5Engines`. Then change the type to `String[]`. The IntelliJ IDEA 
will automatically update the getter and setter.
   Write both abstract getter and setter in the interface 
`SurefireExecutionParameters`. Implement them in `SurefirePlugin` and 
`IntegrationTestMojo`. Move both fields 
[this](https://github.com/apache/maven-surefire/pull/344/commits/e8ef4f5153d5c3f82639e4ec8cd1b1364202dad8#diff-38e379eb63d7dcd2deb45902b4a494517e4ce54c29913bcf74e7d9243ebb7011R507)
 and 
[this](https://github.com/apache/maven-surefire/pull/344/commits/e8ef4f5153d5c3f82639e4ec8cd1b1364202dad8#diff-38e379eb63d7dcd2deb45902b4a494517e4ce54c29913bcf74e7d9243ebb7011R511)
 to `SurefirePlugin` and `IntegrationTestMojo`. Then remove the getters and 
setters in `AbstractSurefireMojo from Line 3815 to 3836. Try to compile the 
project.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to