You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2019/02/03 22:14:45 UTC
[maven-surefire] branch SUREFIRE-1585-tibor2 created (now cb00ee2)
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a change to branch SUREFIRE-1585-tibor2
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.
at cb00ee2 [SUREFIRE-1585] Align JUnit Platform version at runtime
This branch includes the following new commits:
new cb00ee2 [SUREFIRE-1585] Align JUnit Platform version at runtime
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven-surefire] 01/01: [SUREFIRE-1585] Align JUnit Platform
version at runtime
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch SUREFIRE-1585-tibor2
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit cb00ee2536d2e3406a2de4af213286062947afe9
Author: tibordigana <ti...@apache.org>
AuthorDate: Fri Feb 1 06:03:27 2019 +0100
[SUREFIRE-1585] Align JUnit Platform version at runtime
---
.../plugin/surefire/AbstractSurefireMojo.java | 169 ++++++++++++++++-----
.../surefire/SurefireDependencyResolver.java | 19 ++-
.../maven/plugin/surefire/TestClassPath.java | 22 ++-
.../AbstractSurefireMojoJava7PlusTest.java | 5 +-
.../plugin/surefire/AbstractSurefireMojoTest.java | 5 +-
.../maven/surefire/its/JUnitPlatformEnginesIT.java | 8 +-
6 files changed, 175 insertions(+), 53 deletions(-)
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 7c76ef1..4d2af49 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -21,6 +21,8 @@ package org.apache.maven.plugin.surefire;
*/
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.repository.RepositorySystem;
@@ -663,6 +665,9 @@ public abstract class AbstractSurefireMojo
@Parameter( defaultValue = "${project.pluginArtifactRepositories}", readonly = true, required = true )
private List<ArtifactRepository> remoteRepositories;
+ @Parameter( defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true )
+ private List<ArtifactRepository> projectRemoteRepositories;
+
/**
* Flag to disable the generation of report files in xml format.
*
@@ -983,7 +988,8 @@ public abstract class AbstractSurefireMojo
private void executeAfterPreconditionsChecked( @Nonnull DefaultScanResult scanResult )
throws MojoExecutionException, MojoFailureException
{
- List<ProviderInfo> providers = createProviders();
+ TestClassPath testClasspathWrapper = generateTestClasspath();
+ List<ProviderInfo> providers = createProviders( testClasspathWrapper );
RunResult current = noTestsRun();
@@ -992,7 +998,7 @@ public abstract class AbstractSurefireMojo
{
try
{
- current = current.aggregate( executeProvider( provider, scanResult ) );
+ current = current.aggregate( executeProvider( provider, scanResult, testClasspathWrapper ) );
}
catch ( SurefireBooterForkException | SurefireExecutionException | TestSetFailedException e )
{
@@ -1019,13 +1025,13 @@ public abstract class AbstractSurefireMojo
getPluginName() );
}
- protected List<ProviderInfo> createProviders()
+ protected List<ProviderInfo> createProviders( TestClassPath testClasspathWrapper )
throws MojoExecutionException
{
Artifact junitDepArtifact = getJunitDepArtifact();
return new ProviderList( new DynamicProviderInfo( null ),
new TestNgProviderInfo( getTestNgArtifact() ),
- new JUnitPlatformProviderInfo( getJunitPlatformArtifact() ),
+ new JUnitPlatformProviderInfo( getJunitPlatformArtifact(), testClasspathWrapper ),
new JUnitCoreProviderInfo( getJunitArtifact(), junitDepArtifact ),
new JUnit4ProviderInfo( getJunitArtifact(), junitDepArtifact ),
new JUnit3ProviderInfo() )
@@ -1117,7 +1123,8 @@ public abstract class AbstractSurefireMojo
}
@Nonnull
- private RunResult executeProvider( @Nonnull ProviderInfo provider, @Nonnull DefaultScanResult scanResult )
+ private RunResult executeProvider( @Nonnull ProviderInfo provider, @Nonnull DefaultScanResult scanResult,
+ @Nonnull TestClassPath testClasspathWrapper )
throws MojoExecutionException, MojoFailureException, SurefireExecutionException, SurefireBooterForkException,
TestSetFailedException
{
@@ -1132,8 +1139,8 @@ public abstract class AbstractSurefireMojo
{
createCopyAndReplaceForkNumPlaceholder( effectiveProperties, 1 ).copyToSystemProperties();
- InPluginVMSurefireStarter surefireStarter =
- createInprocessStarter( provider, classLoaderConfiguration, runOrderParameters, scanResult, platform );
+ InPluginVMSurefireStarter surefireStarter = createInprocessStarter( provider, classLoaderConfiguration,
+ runOrderParameters, scanResult, platform, testClasspathWrapper );
return surefireStarter.runSuitesInProcess( scanResult );
}
else
@@ -1149,7 +1156,8 @@ public abstract class AbstractSurefireMojo
try
{
forkStarter = createForkStarter( provider, forkConfiguration, classLoaderConfiguration,
- runOrderParameters, getConsoleLogger(), scanResult, platform );
+ runOrderParameters, getConsoleLogger(), scanResult, platform,
+ testClasspathWrapper );
return forkStarter.run( effectiveProperties, scanResult );
}
@@ -1688,7 +1696,7 @@ public abstract class AbstractSurefireMojo
return h;
}
- public File getStatisticsFile( String configurationHash )
+ private File getStatisticsFile( String configurationHash )
{
return new File( getBasedir(), ".surefire-" + configurationHash );
}
@@ -1696,7 +1704,8 @@ public abstract class AbstractSurefireMojo
private StartupConfiguration createStartupConfiguration( @Nonnull ProviderInfo provider, boolean isInprocess,
@Nonnull ClassLoaderConfiguration classLoaderConfiguration,
@Nonnull DefaultScanResult scanResult,
- @Nonnull Platform platform )
+ @Nonnull Platform platform,
+ @Nonnull TestClassPath testClasspathWrapper )
throws MojoExecutionException
{
try
@@ -1714,11 +1723,12 @@ public abstract class AbstractSurefireMojo
.toString();
return newStartupConfigWithModularPath( classLoaderConfiguration, providerArtifacts, providerName,
- getModuleDescriptor(), scanResult, javaHome );
+ getModuleDescriptor(), scanResult, javaHome, testClasspathWrapper );
}
else
{
- return newStartupConfigWithClasspath( classLoaderConfiguration, providerArtifacts, providerName );
+ return newStartupConfigWithClasspath( classLoaderConfiguration, providerArtifacts, providerName,
+ testClasspathWrapper );
}
}
catch ( IOException e )
@@ -1729,13 +1739,10 @@ public abstract class AbstractSurefireMojo
private StartupConfiguration newStartupConfigWithClasspath(
@Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull Set<Artifact> providerArtifacts,
- @Nonnull String providerName )
+ @Nonnull String providerName, @Nonnull TestClassPath testClasspathWrapper )
{
- TestClassPath testClasspathWrapper = generateTestClasspath();
Classpath testClasspath = testClasspathWrapper.toClasspath();
- testClasspathWrapper.avoidArtifactDuplicates( providerArtifacts );
-
Classpath providerClasspath = ClasspathCache.getCachedClassPath( providerName );
if ( providerClasspath == null )
{
@@ -1806,14 +1813,11 @@ public abstract class AbstractSurefireMojo
private StartupConfiguration newStartupConfigWithModularPath(
@Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull Set<Artifact> providerArtifacts,
@Nonnull String providerName, @Nonnull File moduleDescriptor, @Nonnull DefaultScanResult scanResult,
- @Nonnull String javaHome )
+ @Nonnull String javaHome, @Nonnull TestClassPath testClasspathWrapper )
throws IOException
{
- TestClassPath testClasspathWrapper = generateTestClasspath();
Classpath testClasspath = testClasspathWrapper.toClasspath();
- testClasspathWrapper.avoidArtifactDuplicates( providerArtifacts );
-
Classpath providerClasspath = ClasspathCache.getCachedClassPath( providerName );
if ( providerClasspath == null )
{
@@ -2141,11 +2145,12 @@ public abstract class AbstractSurefireMojo
private ForkStarter createForkStarter( @Nonnull ProviderInfo provider, @Nonnull ForkConfiguration forkConfiguration,
@Nonnull ClassLoaderConfiguration classLoaderConfiguration,
@Nonnull RunOrderParameters runOrderParameters, @Nonnull ConsoleLogger log,
- @Nonnull DefaultScanResult scanResult, @Nonnull Platform platform )
+ @Nonnull DefaultScanResult scanResult, @Nonnull Platform platform,
+ @Nonnull TestClassPath testClasspathWrapper )
throws MojoExecutionException, MojoFailureException
{
- StartupConfiguration startupConfiguration =
- createStartupConfiguration( provider, false, classLoaderConfiguration, scanResult, platform );
+ StartupConfiguration startupConfiguration = createStartupConfiguration( provider, false,
+ classLoaderConfiguration, scanResult, platform, testClasspathWrapper );
String configChecksum = getConfigChecksum();
StartupReportConfiguration startupReportConfiguration = getStartupReportConfiguration( configChecksum, true );
ProviderConfiguration providerConfiguration = createProviderConfiguration( runOrderParameters );
@@ -2157,11 +2162,12 @@ public abstract class AbstractSurefireMojo
@Nonnull ClassLoaderConfiguration classLoaderConfig,
@Nonnull RunOrderParameters runOrderParameters,
@Nonnull DefaultScanResult scanResult,
- @Nonnull Platform platform )
+ @Nonnull Platform platform,
+ @Nonnull TestClassPath testClasspathWrapper )
throws MojoExecutionException, MojoFailureException
{
- StartupConfiguration startupConfiguration =
- createStartupConfiguration( provider, true, classLoaderConfig, scanResult, platform );
+ StartupConfiguration startupConfiguration = createStartupConfiguration( provider, true, classLoaderConfig,
+ scanResult, platform, testClasspathWrapper );
String configChecksum = getConfigChecksum();
StartupReportConfiguration startupReportConfiguration = getStartupReportConfiguration( configChecksum, false );
ProviderConfiguration providerConfiguration = createProviderConfiguration( runOrderParameters );
@@ -2504,7 +2510,7 @@ public abstract class AbstractSurefireMojo
*/
private TestClassPath generateTestClasspath()
{
- @SuppressWarnings( "unchecked" ) Set<Artifact> classpathArtifacts = getProject().getArtifacts();
+ Set<Artifact> classpathArtifacts = getProject().getArtifacts();
if ( getClasspathDependencyScopeExclude() != null && !getClasspathDependencyScopeExclude().isEmpty() )
{
@@ -2520,7 +2526,7 @@ public abstract class AbstractSurefireMojo
}
return new TestClassPath( classpathArtifacts, getClassesDirectory(),
- getTestClassesDirectory(), getAdditionalClasspathElements(), getConsoleLogger() );
+ getTestClassesDirectory(), getAdditionalClasspathElements() );
}
/**
@@ -2866,11 +2872,13 @@ public abstract class AbstractSurefireMojo
final class JUnitPlatformProviderInfo
implements ProviderInfo
{
- private final Artifact junitArtifact;
+ private final Artifact junitPlatformArtifact;
+ private final TestClassPath testClasspathWrapper;
- JUnitPlatformProviderInfo( Artifact junitArtifact )
+ JUnitPlatformProviderInfo( Artifact junitPlatformArtifact, TestClassPath testClasspathWrapper )
{
- this.junitArtifact = junitArtifact;
+ this.junitPlatformArtifact = junitPlatformArtifact;
+ this.testClasspathWrapper = testClasspathWrapper;
}
@Override
@@ -2883,7 +2891,7 @@ public abstract class AbstractSurefireMojo
@Override
public boolean isApplicable()
{
- return junitArtifact != null;
+ return junitPlatformArtifact != null;
}
@Override
@@ -2896,8 +2904,101 @@ public abstract class AbstractSurefireMojo
@Nonnull
public Set<Artifact> getProviderClasspath()
{
- String version = surefireBooterArtifact.getBaseVersion();
- return dependencyResolver.getProviderClasspath( "surefire-junit-platform", version );
+ String surefireVersion = surefireBooterArtifact.getBaseVersion();
+ Map<String, Artifact> providerArtifacts =
+ dependencyResolver.getProviderClasspathAsMap( "surefire-junit-platform", surefireVersion );
+ Map<String, Artifact> testDependencies = testClasspathWrapper.getTestDependencies();
+
+ if ( hasDependencyPlatformEngine( testDependencies ) )
+ {
+ String filterTestDependency = "org.junit.platform:junit-platform-engine";
+ logDebugOrCliShowErrors( "Test dependencies contain " + filterTestDependency );
+ narrowProviderDependencies( filterTestDependency, providerArtifacts, testDependencies );
+ }
+ else if ( hasDependencyJupiterAPI( testDependencies ) )
+ {
+ String api = "org.junit.jupiter:junit-jupiter-api";
+ String engineGroupId = "org.junit.jupiter";
+ String engineArtifactId = "junit-jupiter-engine";
+ String version = testDependencies.get( api ).getBaseVersion();
+ addEngineByApi( api, engineGroupId, engineArtifactId, providerArtifacts, testDependencies );
+ alignVersions( version, providerArtifacts, testDependencies );
+ }
+ else if ( hasDependencyJUnit4( testDependencies ) )
+ {
+ String version = testDependencies.get( "junit:junit" ).getBaseVersion();
+ addEngineByApi( "junit:junit", "junit", "junit", providerArtifacts, testDependencies );
+ alignVersions( version, providerArtifacts, testDependencies );
+ }
+ return new LinkedHashSet<>( providerArtifacts.values() );
+ }
+
+ private void addEngineByApi( String api,
+ String engineGroupId, String engineArtifactId,
+ Map<String, Artifact> providerArtifacts,
+ Map<String, Artifact> testDependencies )
+ {
+ String jupiterVersion = testDependencies.get( api ).getBaseVersion();
+ narrowProviderDependencies( api, providerArtifacts, testDependencies );
+ for ( Artifact jupiterDep : resolve( engineGroupId, engineArtifactId, jupiterVersion ) )
+ {
+ String key = jupiterDep.getGroupId() + ":" + jupiterDep.getArtifactId();
+ if ( !testDependencies.containsKey( key ) )
+ {
+ providerArtifacts.put( key, jupiterDep );
+ }
+ }
+ }
+
+ private void narrowProviderDependencies( String filterTestDependency,
+ Map<String, Artifact> providerArtifacts,
+ Map<String, Artifact> testDependencies )
+ {
+ Artifact engine = testDependencies.get( filterTestDependency );
+ for ( Artifact engineDep : resolve( engine.getGroupId(), engine.getArtifactId(), engine.getVersion() ) )
+ {
+ providerArtifacts.remove( engineDep.getGroupId() + ":" + engineDep.getArtifactId() );
+ }
+ alignVersions( version, providerArtifacts, testDependencies );
+ }
+
+ private void alignVersions( String version,
+ Map<String, Artifact> providerArtifacts,
+ Map<String, Artifact> testDependencies )
+ {
+ for ( Artifact launcherArtifact : resolve( "org.junit.platform", "junit-platform-launcher", version ) )
+ {
+ String key = launcherArtifact.getGroupId() + ":" + launcherArtifact.getArtifactId();
+ if ( !testDependencies.containsKey( key ) )
+ {
+ providerArtifacts.put( key, launcherArtifact );
+ }
+ }
+ }
+
+ private Set<Artifact> resolve( String g, String a, String v )
+ {
+ ArtifactHandler handler = junitPlatformArtifact.getArtifactHandler();
+ Artifact artifact = new DefaultArtifact( g, a, v, null, "jar", null, handler );
+ logDebugOrCliShowErrors( "Resolving artifact " + g + ":" + a + ":" + v );
+ Set<Artifact> r = dependencyResolver.resolveArtifact( artifact ).getArtifacts();
+ logDebugOrCliShowErrors( "Resolved artifact " + g + ":" + a + ":" + v + " to " + r );
+ return r;
+ }
+
+ private boolean hasDependencyJUnit4( Map<String, Artifact> providerArtifacts )
+ {
+ return providerArtifacts.containsKey( "junit:junit" );
+ }
+
+ private boolean hasDependencyJupiterAPI( Map<String, Artifact> providerArtifacts )
+ {
+ return providerArtifacts.containsKey( "org.junit.jupiter:junit-jupiter-api" );
+ }
+
+ private boolean hasDependencyPlatformEngine( Map<String, Artifact> providerArtifacts )
+ {
+ return providerArtifacts.containsKey( "org.junit.platform:junit-platform-engine" );
}
}
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
index b255f38..fd0f37a 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
@@ -20,6 +20,7 @@ package org.apache.maven.plugin.surefire;
*/
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -78,16 +79,20 @@ final class SurefireDependencyResolver
private final List<ArtifactRepository> remoteRepositories;
+ private final List<ArtifactRepository> projectRemoteRepositories;
+
private final String pluginName;
SurefireDependencyResolver( RepositorySystem repositorySystem, ConsoleLogger log,
ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories, String pluginName )
+ List<ArtifactRepository> remoteRepositories,
+ List<ArtifactRepository> projectRemoteRepositories, String pluginName )
{
this.repositorySystem = repositorySystem;
this.log = log;
this.localRepository = localRepository;
this.remoteRepositories = remoteRepositories;
+ this.projectRemoteRepositories = projectRemoteRepositories;
this.pluginName = pluginName;
}
@@ -157,6 +162,18 @@ final class SurefireDependencyResolver
return orderProviderArtifacts( result.getArtifacts() );
}
+ @Nonnull
+ Map<String, Artifact> getProviderClasspathAsMap( String providerArtifactId, String providerVersion )
+ {
+ Map<String, Artifact> cpArtifactsMapping = new LinkedHashMap<>();
+ for ( Artifact cpArtifact : getProviderClasspath( providerArtifactId, providerVersion ) )
+ {
+ String key = cpArtifact.getGroupId() + ":" + cpArtifact.getArtifactId();
+ cpArtifactsMapping.put( key, cpArtifact );
+ }
+ return cpArtifactsMapping;
+ }
+
Set<Artifact> addProviderToClasspath( Map<String, Artifact> pluginArtifactMap, Artifact mojoPluginArtifact,
Artifact surefireCommon, Artifact surefireApi, Artifact surefireLoggerApi )
{
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/TestClassPath.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/TestClassPath.java
index ee8fadb..7797b79 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/TestClassPath.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/TestClassPath.java
@@ -20,14 +20,14 @@ package org.apache.maven.plugin.surefire;
*/
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
import org.apache.maven.surefire.booter.Classpath;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Set;
+import java.util.Map;
import static java.util.Collections.addAll;
import static org.apache.maven.shared.utils.StringUtils.split;
@@ -38,27 +38,33 @@ final class TestClassPath
private final File classesDirectory;
private final File testClassesDirectory;
private final String[] additionalClasspathElements;
- private final ConsoleLogger logger;
TestClassPath( Iterable<Artifact> artifacts,
File classesDirectory,
File testClassesDirectory,
- String[] additionalClasspathElements,
- ConsoleLogger logger )
+ String[] additionalClasspathElements )
{
this.artifacts = artifacts;
this.classesDirectory = classesDirectory;
this.testClassesDirectory = testClassesDirectory;
this.additionalClasspathElements = additionalClasspathElements;
- this.logger = logger;
+ }
+
+ Map<String, Artifact> getTestDependencies()
+ {
+ Map<String, Artifact> artifactMapping = new LinkedHashMap<>();
+ for ( Artifact artifact : artifacts )
+ {
+ artifactMapping.put( artifact.getGroupId() + ":" + artifact.getArtifactId(), artifact );
+ }
+ return artifactMapping;
}
void avoidArtifactDuplicates( Set<Artifact> providerArtifacts )
{
for ( Artifact artifact : artifacts )
{
- Iterator<Artifact> it = providerArtifacts.iterator();
- while ( it.hasNext() )
+ for ( Iterator<Artifact> it = providerArtifacts.iterator(); it.hasNext(); )
{
Artifact providerArtifact = it.next();
String classifier1 = providerArtifact.getClassifier();
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
index 0f9ee80..2d268bc 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
@@ -108,7 +108,7 @@ public class AbstractSurefireMojoJava7PlusTest
TestClassPath testClasspath =
new TestClassPath( asList( modular, nonModular, junit, hamcrest ), classesDir, testClassesDir,
- null, null );
+ null );
doReturn( testClasspath ).when( mojo, "generateTestClasspath" );
doReturn( 1 ).when( mojo, "getEffectiveForkCount" );
@@ -171,11 +171,10 @@ public class AbstractSurefireMojoJava7PlusTest
StartupConfiguration conf = invokeMethod( mojo, "newStartupConfigWithModularPath",
classLoaderConfiguration, providerClasspath, "org.asf.Provider", moduleInfo, scanResult,
- "" );
+ "", testClasspath );
verify( mojo, times( 1 ) ).effectiveIsEnableAssertions();
verify( mojo, times( 1 ) ).isChildDelegation();
- verifyPrivate( mojo, times( 1 ) ).invoke( "generateTestClasspath" );
verify( mojo, times( 1 ) ).getEffectiveForkCount();
verify( mojo, times( 1 ) ).getTestClassesDirectory();
verify( scanResult, times( 1 ) ).getClasses();
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
index a6fc708..c9a332a 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
@@ -247,7 +247,7 @@ public class AbstractSurefireMojoTest
File classesDir = mockFile( "classes" );
File testClassesDir = mockFile( "test-classes" );
TestClassPath testClasspath =
- new TestClassPath( asList( junit, hamcrest ), classesDir, testClassesDir, null, null );
+ new TestClassPath( asList( junit, hamcrest ), classesDir, testClassesDir, null );
doReturn( testClasspath ).when( mojo, "generateTestClasspath" );
doReturn( 1 ).when( mojo, "getEffectiveForkCount" );
@@ -267,11 +267,10 @@ public class AbstractSurefireMojoTest
when( mojo.getConsoleLogger() ).thenReturn( new PluginConsoleLogger( logger ) );
StartupConfiguration conf = invokeMethod( mojo, "newStartupConfigWithClasspath",
- classLoaderConfiguration, providerArtifacts, "org.asf.Provider" );
+ classLoaderConfiguration, providerArtifacts, "org.asf.Provider", testClasspath );
verify( mojo, times( 1 ) ).effectiveIsEnableAssertions();
verify( mojo, times( 1 ) ).isChildDelegation();
- verifyPrivate( mojo, times( 1 ) ).invoke( "generateTestClasspath" );
verify( mojo, times( 1 ) ).getEffectiveForkCount();
ArgumentCaptor<String> argument = ArgumentCaptor.forClass( String.class );
verify( logger, times( 6 ) ).debug( argument.capture() );
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 6147c2f..af8f366 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
@@ -59,13 +59,13 @@ public class JUnitPlatformEnginesIT
@Parameters(name = "{0}")
public static Iterable<Object[]> regexVersions()
{
- ArrayList<Object[]> args = new ArrayList<Object[]>();
+ ArrayList<Object[]> args = new ArrayList<>();
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.2", "5.3.2", "1.1.1", "1.0.0" } );
args.add( new Object[] { "1.4.0-SNAPSHOT", "5.4.0-SNAPSHOT", "1.1.1", "1.0.0" } );
- args.add( new Object[] { "1.4.0-RC1", "5.4.0-RC1", "1.1.1", "1.0.0" } );
+ args.add( new Object[] { "1.4.0-RC2", "5.4.0-RC2", "1.1.1", "1.0.0" } );
return args;
}
@@ -124,7 +124,7 @@ public class JUnitPlatformEnginesIT
regex( toRegex( "*surefire-api-*.jar*" ) ),
regex( toRegex( "*surefire-logger-api-*.jar*" ) ),
regex( toRegex( "*common-java5-*.jar*" ) ),
- regex( toRegex( "*junit-platform-launcher-1.3.2.jar*" ) )
+ regex( toRegex( "*junit-platform-launcher-" + platform + ".jar*" ) )
) );
lines = validator.loadLogLines( startsWith( "[DEBUG] boot(compact) classpath" ) );
@@ -148,7 +148,7 @@ public class JUnitPlatformEnginesIT
regex( toRegex( "*opentest4j-" + opentest + ".jar*" ) ),
regex( toRegex( "*junit-jupiter-api-" + jupiter + ".jar*" ) ),
regex( toRegex( "*surefire-junit-platform-*.jar*" ) ),
- regex( toRegex( "*junit-platform-launcher-1.3.2.jar*" ) )
+ regex( toRegex( "*junit-platform-launcher-" + platform + ".jar*" ) )
) );
}