This is an automated email from the ASF dual-hosted git repository.

sor pushed a commit to branch release/2.22.3
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit f14da3b893805c658b7a6fdd1ff7732e467b3603
Author: Christian Stein <sormu...@gmail.com>
AuthorDate: Wed Mar 25 10:24:44 2020 +0100

    [SUREFIRE-1764] Upgrade JUnit Platform to 1.6.1
    
    The JUnit team improved error reporting for engine
    discovery/execution failures. The relevant changes are
    in DefaultLauncher which is contained in the
    junit-platform-launcher artifact.
    
    This commit upgrades the JUnit Platform version to 1.6.1,
    JUnit Jupiter and Vintage to 5.6.1, and other projects
    required in integration tests accordingly.
    
    See also https://issues.apache.org/jira/browse/SUREFIRE-1764
---
 .../maven/surefire/its/JUnitPlatformEnginesIT.java | 101 ++++++++-------------
 .../resources/junit-platform-engine-jqwik/pom.xml  |   2 +-
 .../junit-platform-engine-jupiter/pom.xml          |  12 +--
 .../junit-platform-engine-vintage/pom.xml          |   2 +-
 .../junit-platform-multiple-engines/pom.xml        |  14 +--
 .../src/test/resources/junit-platform-tags/pom.xml |   2 +-
 .../src/test/resources/junit-platform/pom.xml      |   9 ++
 .../surefire-1614-stream-corruption/pom.xml        |   4 +-
 surefire-providers/surefire-junit-platform/pom.xml |   4 +-
 .../junitplatform/RunListenerAdapterTest.java      |  11 ++-
 .../junitplatform/TestMethodFilterTest.java        |   8 +-
 11 files changed, 71 insertions(+), 98 deletions(-)

diff --git 
a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java
 
b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java
index 46f5ebd..4de1c8c 100644
--- 
a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java
+++ 
b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java
@@ -33,11 +33,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import static 
org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
-import static org.apache.maven.surefire.its.fixture.IsRegex.regex;
 import static org.fest.assertions.Assertions.assertThat;
-import static org.fest.util.Collections.set;
 import static org.hamcrest.CoreMatchers.startsWith;
-import static org.junit.Assert.assertThat;
 
 @RunWith( Parameterized.class )
 public class JUnitPlatformEnginesIT
@@ -56,13 +53,16 @@ public class JUnitPlatformEnginesIT
     public String apiguardian;
 
     @Parameters(name = "{0}")
-    public static Iterable<Object[]> regexVersions()
+    public static Iterable<Object[]> versions()
     {
         ArrayList<Object[]> args = new ArrayList<Object[]>();
-        args.add( new Object[] { "1.0.0", "5.0.0", "1.0.0", "1.0.0" } );
+        args.add( new Object[] { "1.0.3", "5.0.3", "1.0.0", "1.0.0" } );
         args.add( new Object[] { "1.1.1", "5.1.1", "1.0.0", "1.0.0" } );
         args.add( new Object[] { "1.2.0", "5.2.0", "1.1.0", "1.0.0" } );
-        args.add( new Object[] { "1.3.1", "5.3.1", "1.1.1", "1.0.0" } );
+        args.add( new Object[] { "1.3.2", "5.3.2", "1.1.1", "1.0.0" } );
+        args.add( new Object[] { "1.4.1", "5.4.1", "1.1.1", "1.0.0" } );
+        args.add( new Object[] { "1.5.2", "5.5.2", "1.2.0", "1.1.0" } );
+        args.add( new Object[] { "1.6.1", "5.6.1", "1.2.0", "1.1.0" } );
         return args;
     }
 
@@ -73,87 +73,62 @@ public class JUnitPlatformEnginesIT
     }
 
     @Test
-    public void testToRegex()
-    {
-        String regex = toRegex( ".[]()*" );
-        assertThat( regex )
-                .isEqualTo( "\\.\\[\\]\\(\\).*" );
-    }
-
-    @Test
     public void platform() throws VerificationException
     {
         OutputValidator validator = unpack( "junit-platform", '-' + platform )
                 .sysProp( "jupiter.version", jupiter )
+                .sysProp( "platform.version", platform )
                 .addGoal( "-X" )
                 .executeTest()
                 .verifyErrorFree( 1 );
 
-        String testClasspath = "[DEBUG] test(compact) classpath:"
-                + "  test-classes"
-                + "  classes"
-                + "  junit-jupiter-engine-" + jupiter + ".jar"
-                + "  apiguardian-api-" + apiguardian + ".jar"
-                + "  junit-platform-engine-" + platform + ".jar"
-                + "  junit-platform-commons-" + platform + ".jar"
-                + "  opentest4j-" + opentest + ".jar"
-                + "  junit-jupiter-api-" + jupiter + ".jar";
-
         List<String> lines = validator.loadLogLines( startsWith( "[DEBUG] 
test(compact) classpath" ) );
 
         assertThat( lines )
                 .hasSize( 1 );
 
-        String line = lines.get( 0 );
-
-        assertThat( set( line ), regex( toRegex( testClasspath ) ) );
-
-        String providerClasspath = "[DEBUG] provider(compact) classpath:"
-                + "  surefire-junit-platform-*.jar"
-                + "  junit-platform-launcher-1.3.1.jar"
-                + "  surefire-api-*.jar"
-                + "  surefire-logger-api-*.jar";
+        assertThat( lines.get( 0 ) )
+                .startsWith( "[DEBUG] test(compact) classpath" )
+                .contains( "classes" )
+                .contains( "test-classes" )
+                .contains( "apiguardian-api-" + apiguardian + ".jar" )
+                .contains( "junit-jupiter-api-" + jupiter + ".jar" )
+                .contains( "junit-jupiter-engine-" + jupiter + ".jar" )
+                .contains( "junit-platform-engine-" + platform + ".jar" )
+                .contains( "junit-platform-commons-" + platform + ".jar" )
+                .contains( "junit-platform-launcher-" + platform + ".jar" )
+                .contains( "opentest4j-" + opentest + ".jar" );
 
         lines = validator.loadLogLines( startsWith( "[DEBUG] provider(compact) 
classpath" ) );
 
         assertThat( lines )
                 .hasSize( 1 );
 
-        line = lines.get( 0 );
-
-        assertThat( set( line ), regex( toRegex( providerClasspath ) ) );
-
-        String bootClasspath = "[DEBUG] boot(compact) classpath:"
-                + "  surefire-booter-*.jar"
-                + "  surefire-api-*.jar"
-                + "  surefire-logger-api-*.jar"
-                + "  test-classes"
-                + "  classes"
-                + "  junit-jupiter-engine-" + jupiter + ".jar"
-                + "  apiguardian-api-" + apiguardian + ".jar"
-                + "  junit-platform-engine-" + platform + ".jar"
-                + "  junit-platform-commons-" + platform + ".jar"
-                + "  opentest4j-" + opentest + ".jar"
-                + "  junit-jupiter-api-" + jupiter + ".jar"
-                + "  surefire-junit-platform-*.jar"
-                + "  junit-platform-launcher-1.3.1.jar";
+        assertThat( lines.get( 0 ) )
+                .startsWith( "[DEBUG] provider(compact) classpath" )
+                .contains( "surefire-api-" /* {VERSION}.jar */ )
+                .contains( "surefire-junit-platform-" /* {VERSION}.jar */ )
+                .contains( "surefire-logger-api-" /* {VERSION}.jar */ );
 
         lines = validator.loadLogLines( startsWith( "[DEBUG] boot(compact) 
classpath" ) );
 
         assertThat( lines )
                 .hasSize( 1 );
 
-        line = lines.get( 0 );
-
-        assertThat( set( line ), regex( toRegex( bootClasspath ) ) );
-    }
-
-    private static String toRegex(String text) {
-        return text.replaceAll( "\\.", "\\\\." )
-                .replaceAll( "\\[", "\\\\[" )
-                .replaceAll( "]", "\\\\]" )
-                .replaceAll( "\\(", "\\\\(" )
-                .replaceAll( "\\)", "\\\\)" )
-                .replaceAll( "\\*", ".*" );
+        assertThat( lines.get( 0 ) )
+                .startsWith( "[DEBUG] boot(compact) classpath" )
+                .contains( "surefire-api-" /* {VERSION}.jar */ )
+                .contains( "surefire-booter-" /* {VERSION}.jar */ )
+                .contains( "surefire-junit-platform-" /* {VERSION}.jar */ )
+                .contains( "surefire-logger-api-" /* {VERSION}.jar */ )
+                .contains( "classes" )
+                .contains( "test-classes" )
+                .contains( "apiguardian-api-" + apiguardian + ".jar" )
+                .contains( "junit-jupiter-api-" + jupiter + ".jar" )
+                .contains( "junit-jupiter-engine-" + jupiter + ".jar" )
+                .contains( "junit-platform-engine-" + platform + ".jar" )
+                .contains( "junit-platform-commons-" + platform + ".jar" )
+                .contains( "junit-platform-launcher-" + platform + ".jar" )
+                .contains( "opentest4j-" + opentest + ".jar" );
     }
 }
diff --git 
a/surefire-its/src/test/resources/junit-platform-engine-jqwik/pom.xml 
b/surefire-its/src/test/resources/junit-platform-engine-jqwik/pom.xml
index 8e27d56..2adbbd5 100644
--- a/surefire-its/src/test/resources/junit-platform-engine-jqwik/pom.xml
+++ b/surefire-its/src/test/resources/junit-platform-engine-jqwik/pom.xml
@@ -42,7 +42,7 @@
         <dependency>
             <groupId>net.jqwik</groupId>
             <artifactId>jqwik</artifactId>
-            <version>0.8.10</version>
+            <version>1.2.5</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml 
b/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml
index 192cc8a..2243e54 100644
--- a/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml
+++ b/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml
@@ -31,11 +31,11 @@
     <properties>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
-        <junit.jupiter.version>5.2.0</junit.jupiter.version>
+        <junit.jupiter.version>5.6.1</junit.jupiter.version>
     </properties>
 
     <!--
-        Declare "junit-jupiter-engine" dependency because the
+        Declare aggregator "junit-jupiter" dependency because the
         Jupiter Engine is needed at test runtime. Artifacts
         needed for test compilation, like "junit-jupiter-api",
         are pulled-in via transitive dependency resolution.
@@ -43,13 +43,7 @@
     <dependencies>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-engine</artifactId>
-            <version>${junit.jupiter.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-params</artifactId>
+            <artifactId>junit-jupiter</artifactId>
             <version>${junit.jupiter.version}</version>
             <scope>test</scope>
         </dependency>
diff --git 
a/surefire-its/src/test/resources/junit-platform-engine-vintage/pom.xml 
b/surefire-its/src/test/resources/junit-platform-engine-vintage/pom.xml
index 38b788f..b13c4d3 100644
--- a/surefire-its/src/test/resources/junit-platform-engine-vintage/pom.xml
+++ b/surefire-its/src/test/resources/junit-platform-engine-vintage/pom.xml
@@ -43,7 +43,7 @@
         <dependency>
             <groupId>org.junit.vintage</groupId>
             <artifactId>junit-vintage-engine</artifactId>
-            <version>5.2.0</version>
+            <version>5.6.1</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/surefire-its/src/test/resources/junit-platform-multiple-engines/pom.xml 
b/surefire-its/src/test/resources/junit-platform-multiple-engines/pom.xml
index e7f50a3..69d3167 100644
--- a/surefire-its/src/test/resources/junit-platform-multiple-engines/pom.xml
+++ b/surefire-its/src/test/resources/junit-platform-multiple-engines/pom.xml
@@ -36,26 +36,20 @@
     <dependencies>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-engine</artifactId>
-            <version>5.2.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-params</artifactId>
-            <version>5.2.0</version>
+            <artifactId>junit-jupiter</artifactId>
+            <version>5.6.1</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.junit.vintage</groupId>
             <artifactId>junit-vintage-engine</artifactId>
-            <version>5.2.0</version>
+            <version>5.6.1</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>net.jqwik</groupId>
             <artifactId>jqwik</artifactId>
-            <version>0.8.10</version>
+            <version>1.2.5</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/surefire-its/src/test/resources/junit-platform-tags/pom.xml 
b/surefire-its/src/test/resources/junit-platform-tags/pom.xml
index 0fb64cf..e81dbb1 100644
--- a/surefire-its/src/test/resources/junit-platform-tags/pom.xml
+++ b/surefire-its/src/test/resources/junit-platform-tags/pom.xml
@@ -36,7 +36,7 @@
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-engine</artifactId>
-            <version>5.2.0</version>
+            <version>5.6.1</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/surefire-its/src/test/resources/junit-platform/pom.xml 
b/surefire-its/src/test/resources/junit-platform/pom.xml
index 02e5c00..e43f554 100644
--- a/surefire-its/src/test/resources/junit-platform/pom.xml
+++ b/surefire-its/src/test/resources/junit-platform/pom.xml
@@ -38,6 +38,9 @@
         Jupiter Engine is needed at test runtime. Artifacts
         needed for test compilation, like "junit-jupiter-api",
         are pulled-in via transitive dependency resolution.
+
+        Also require "junit-platform-launcher" to force the
+        resolution of the matching JUnit Platform version.
     -->
     <dependencies>
         <dependency>
@@ -46,6 +49,12 @@
             <version>${jupiter.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.junit.platform</groupId>
+            <artifactId>junit-platform-launcher</artifactId>
+            <version>${platform.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git 
a/surefire-its/src/test/resources/surefire-1614-stream-corruption/pom.xml 
b/surefire-its/src/test/resources/surefire-1614-stream-corruption/pom.xml
index 25726cb..ff54b1e 100644
--- a/surefire-its/src/test/resources/surefire-1614-stream-corruption/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1614-stream-corruption/pom.xml
@@ -3,7 +3,7 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.maven.plugins.surefire</groupId>
-    <artifactId>junit-platform-1.0.0</artifactId>
+    <artifactId>surefire-1614-stream-corruption</artifactId>
     <version>1.0</version>
     <name>[SUREFIRE-1614] JUnit 5: Vintage Output Stream Corruption</name>
 
@@ -17,7 +17,7 @@
         <dependency>
             <groupId>org.junit.vintage</groupId>
             <artifactId>junit-vintage-engine</artifactId>
-            <version>5.3.2</version>
+            <version>5.6.1</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/surefire-providers/surefire-junit-platform/pom.xml 
b/surefire-providers/surefire-junit-platform/pom.xml
index 3aa5820..b50dc6d 100644
--- a/surefire-providers/surefire-junit-platform/pom.xml
+++ b/surefire-providers/surefire-junit-platform/pom.xml
@@ -86,12 +86,12 @@
         <dependency>
             <groupId>org.junit.platform</groupId>
             <artifactId>junit-platform-launcher</artifactId>
-            <version>1.3.1</version>
+            <version>1.6.1</version>
         </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-engine</artifactId>
-            <version>5.3.1</version>
+            <version>5.6.1</version>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git 
a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
 
b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
index 0ccb4fe..a6cbddd 100644
--- 
a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
+++ 
b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
@@ -46,9 +46,9 @@ import org.apache.maven.surefire.report.SimpleReportEntry;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.engine.config.JupiterConfiguration;
 import org.junit.jupiter.engine.descriptor.ClassTestDescriptor;
 import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
-import org.junit.platform.engine.ConfigurationParameters;
 import org.junit.platform.engine.TestDescriptor;
 import org.junit.platform.engine.TestDescriptor.Type;
 import org.junit.platform.engine.TestExecutionResult;
@@ -69,7 +69,7 @@ import org.mockito.InOrder;
  */
 public class RunListenerAdapterTest
 {
-    private static final ConfigurationParameters CONFIG_PARAMS = 
mock(ConfigurationParameters.class);
+    private static final JupiterConfiguration JUPITER_CONFIGURATION = 
mock(JupiterConfiguration.class);
 
     private RunListener listener;
 
@@ -412,7 +412,7 @@ public class RunListenerAdapterTest
                     throws NoSuchMethodException
     {
         TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor( 
newId(), MyTestClass.class,
-                MyTestClass.class.getDeclaredMethod( "myNamedTestMethod" ) );
+                MyTestClass.class.getDeclaredMethod( "myNamedTestMethod" ), 
JUPITER_CONFIGURATION );
 
         TestIdentifier factoryIdentifier = TestIdentifier.from( descriptor );
         ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass( 
ReportEntry.class );
@@ -437,7 +437,8 @@ public class RunListenerAdapterTest
         return new TestMethodTestDescriptor(
                         UniqueId.forEngine( "method" ),
                         MyTestClass.class,
-                        MyTestClass.class.getDeclaredMethod( 
MY_TEST_METHOD_NAME, parameterTypes ) );
+                        MyTestClass.class.getDeclaredMethod( 
MY_TEST_METHOD_NAME, parameterTypes ),
+                        JUPITER_CONFIGURATION );
     }
 
     private static TestIdentifier newClassIdentifier()
@@ -447,7 +448,7 @@ public class RunListenerAdapterTest
 
     private static TestDescriptor newClassDescriptor()
     {
-        return new ClassTestDescriptor( UniqueId.root( "class", 
MyTestClass.class.getName() ), MyTestClass.class, CONFIG_PARAMS );
+        return new ClassTestDescriptor( UniqueId.root( "class", 
MyTestClass.class.getName() ), MyTestClass.class, JUPITER_CONFIGURATION );
     }
 
     private static TestIdentifier newSourcelessChildIdentifierWithParent(
diff --git 
a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
 
b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
index 6d4394e..3633faa 100644
--- 
a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
+++ 
b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
@@ -29,9 +29,9 @@ import java.lang.reflect.Method;
 
 import org.apache.maven.surefire.testset.TestListResolver;
 import org.junit.Test;
+import org.junit.jupiter.engine.config.JupiterConfiguration;
 import org.junit.jupiter.engine.descriptor.ClassTestDescriptor;
 import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
-import org.junit.platform.engine.ConfigurationParameters;
 import org.junit.platform.engine.FilterResult;
 import org.junit.platform.engine.UniqueId;
 
@@ -42,7 +42,7 @@ import org.junit.platform.engine.UniqueId;
  */
 public class TestMethodFilterTest
 {
-    private static final ConfigurationParameters CONFIG_PARAMS = 
mock(ConfigurationParameters.class);
+    private static final JupiterConfiguration JUPITER_CONFIGURATION = 
mock(JupiterConfiguration.class);
 
     private final TestListResolver resolver = mock( TestListResolver.class );
 
@@ -87,13 +87,13 @@ public class TestMethodFilterTest
         UniqueId uniqueId = UniqueId.forEngine( "method" );
         Class<TestClass> testClass = TestClass.class;
         Method testMethod = testClass.getMethod( "testMethod" );
-        return new TestMethodTestDescriptor( uniqueId, testClass, testMethod );
+        return new TestMethodTestDescriptor( uniqueId, testClass, testMethod, 
JUPITER_CONFIGURATION);
     }
 
     private static ClassTestDescriptor newClassTestDescriptor()
     {
         UniqueId uniqueId = UniqueId.forEngine( "class" );
-        return new ClassTestDescriptor( uniqueId, TestClass.class, 
CONFIG_PARAMS );
+        return new ClassTestDescriptor( uniqueId, TestClass.class, 
JUPITER_CONFIGURATION);
     }
 
     public static class TestClass

Reply via email to