maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] Tibor17 commented on a change in pull request #196: [SUREFIRE-1585] [WIP] Resolve missing and align "JUnit 5" artifacts
Date Sat, 10 Nov 2018 22:17:27 GMT
Tibor17 commented on a change in pull request #196: [SUREFIRE-1585] [WIP] Resolve missing and
align "JUnit 5" artifacts
URL: https://github.com/apache/maven-surefire/pull/196#discussion_r232467808
 
 

 ##########
 File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
 ##########
 @@ -2846,8 +2849,92 @@ public void addProviderProperties()
         @Nonnull
         public Set<Artifact> getProviderClasspath()
         {
+            String provider = "surefire-junit-platform";
             String version = surefireBooterArtifact.getBaseVersion();
-            return dependencyResolver.getProviderClasspath( "surefire-junit-platform", version
);
+            Set<Artifact> providerArtifacts = dependencyResolver.getProviderClasspath(
provider, version );
+            alignJUnitPlatformVersion( providerArtifacts );
+            resolveJUnitJupiterEngine( providerArtifacts );
+            resolveJUnitVintageEngine( providerArtifacts );
+            return providerArtifacts;
+        }
+
+        private void resolveJUnitJupiterEngine( Set<Artifact> providerArtifacts )
+        {
+            Artifact junitJupiterApi = getProjectArtifactMap().get( "org.junit.jupiter:junit-jupiter-api"
);
+            if ( junitJupiterApi == null ) // no api, no engine
+            {
+                return;
+            }
+            Artifact junitJupiterEngine = getProjectArtifactMap().get( "org.junit.jupiter:junit-jupiter-engine"
);
+            if ( junitJupiterEngine != null ) // engine already resolved by project
+            {
+                return;
 
 Review comment:
   I think `get()` in hashMap is fast enough which value can be used to evaluate it within
IF argument and then continue with the main stuff. It makes sense to me to warp the algorithm
around IF-ELSE without using `return` in the middle within the algorithm.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message