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 2017/12/03 22:46:50 UTC
maven-surefire git commit: [SUREFIRE-1439] NullPointerException on
JDK10
Repository: maven-surefire
Updated Branches:
refs/heads/SUREFIRE-1439 [created] cb5173d08
[SUREFIRE-1439] NullPointerException on JDK10
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/cb5173d0
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/cb5173d0
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/cb5173d0
Branch: refs/heads/SUREFIRE-1439
Commit: cb5173d0846edb4b83ebf20fe8618bf881ddba0c
Parents: 47af38f
Author: Tibor17 <ti...@apache.org>
Authored: Sun Dec 3 23:46:27 2017 +0100
Committer: Tibor17 <ti...@apache.org>
Committed: Sun Dec 3 23:46:27 2017 +0100
----------------------------------------------------------------------
.../plugin/surefire/AbstractSurefireMojo.java | 17 +++--
.../surefire/AbstractSurefireMojoTest.java | 7 +-
.../maven/surefire/booter/SystemUtils.java | 77 ++++++++++++++++----
.../maven/surefire/booter/SystemUtilsTest.java | 21 ++++--
.../maven/surefire/its/AbstractJigsawIT.java | 13 ++--
.../its/CheckTestNgListenerReporterIT.java | 21 +++---
.../surefire/its/JUnit47WithCucumberIT.java | 3 +-
.../surefire/its/fixture/HelperAssertions.java | 10 +--
.../Surefire1177TestngParallelSuitesIT.java | 3 +-
.../its/jiras/Surefire1211JUnitTestNgIT.java | 5 +-
10 files changed, 115 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
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 7beea89..dca5c56 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
@@ -96,6 +96,7 @@ import java.io.File;
import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
@@ -115,18 +116,17 @@ import static java.lang.Thread.currentThread;
import static java.util.Arrays.asList;
import static java.util.Collections.addAll;
import static java.util.Collections.singletonMap;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.JavaVersion.JAVA_RECENT;
import static org.apache.commons.lang3.StringUtils.substringBeforeLast;
import static org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
import static org.apache.maven.shared.utils.StringUtils.capitalizeFirstLetter;
import static org.apache.maven.shared.utils.StringUtils.isEmpty;
import static org.apache.maven.shared.utils.StringUtils.isNotBlank;
import static org.apache.maven.shared.utils.StringUtils.isNotEmpty;
import static org.apache.maven.shared.utils.StringUtils.split;
+import static org.apache.maven.surefire.booter.SystemUtils.JAVA_SPECIFICATION_VERSION;
import static org.apache.maven.surefire.booter.SystemUtils.endsWithJavaPath;
+import static org.apache.maven.surefire.booter.SystemUtils.isBuiltInJava7AtLeast;
+import static org.apache.maven.surefire.booter.SystemUtils.isBuiltInJava9AtLeast;
import static org.apache.maven.surefire.booter.SystemUtils.isJava9AtLeast;
import static org.apache.maven.surefire.booter.SystemUtils.toJdkHomeFromJvmExec;
import static org.apache.maven.surefire.booter.SystemUtils.toJdkVersionFromReleaseFile;
@@ -2208,7 +2208,7 @@ public abstract class AbstractSurefireMojo
}
File jdkHome = toJdkHomeFromJvmExec( pathToJava.getPath() );
- Double version = jdkHome == null ? null : toJdkVersionFromReleaseFile( jdkHome );
+ BigDecimal version = jdkHome == null ? null : toJdkVersionFromReleaseFile( jdkHome );
boolean javaVersion9 = version == null ? isJava9AtLeast( pathToJava.getPath() ) : isJava9AtLeast( version );
return new JdkAttributes( pathToJava.getPath(), javaVersion9 );
}
@@ -2238,9 +2238,10 @@ public abstract class AbstractSurefireMojo
// use the same JVM as the one used to run Maven (the "java.home" one)
String jvmToUse = System.getProperty( "java.home" ) + File.separator + "bin" + File.separator + "java";
- getConsoleLogger().debug( "Using JVM: " + jvmToUse + " with Java version " + JAVA_RECENT.toString() );
+ getConsoleLogger().debug( "Using JVM: " + jvmToUse + " with Java version "
+ + JAVA_SPECIFICATION_VERSION.toPlainString() );
- return new JdkAttributes( jvmToUse, isJavaVersionAtLeast( JAVA_9 ) );
+ return new JdkAttributes( jvmToUse, isBuiltInJava9AtLeast() );
}
private Artifact getSurefireBooterArtifact()
@@ -3043,7 +3044,7 @@ public abstract class AbstractSurefireMojo
// todo use Java7 java.nio.file.Files.createTempDirectory()
File createSurefireBootDirectoryInTemp()
{
- if ( isJavaVersionAtLeast( JAVA_1_7 ) )
+ if ( isBuiltInJava7AtLeast() )
{
try
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
----------------------------------------------------------------------
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 44c8fe6..0fbe91b 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
@@ -57,9 +57,8 @@ import java.util.Set;
import static java.io.File.separatorChar;
import static java.util.Arrays.asList;
import static java.util.Collections.singleton;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
import static org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
+import static org.apache.maven.surefire.booter.SystemUtils.isBuiltInJava7AtLeast;
import static org.fest.assertions.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;
import static org.mockito.ArgumentMatchers.anyString;
@@ -326,7 +325,7 @@ public class AbstractSurefireMojoTest
@Test
public void shouldHaveTmpDirectory() throws IOException
{
- assumeTrue( isJavaVersionAtLeast( JAVA_1_7 ) );
+ assumeTrue( isBuiltInJava7AtLeast() );
Path path = ( Path ) AbstractSurefireMojo.createTmpDirectoryWithJava7( "surefire" );
@@ -348,7 +347,7 @@ public class AbstractSurefireMojoTest
@Test
public void shouldHaveTmpDirectoryName() throws IOException
{
- assumeTrue( isJavaVersionAtLeast( JAVA_1_7 ) );
+ assumeTrue( isBuiltInJava7AtLeast() );
String dir = AbstractSurefireMojo.createTmpDirectoryNameWithJava7( "surefire" );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemUtils.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemUtils.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemUtils.java
index 38c9310..0a68a80 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemUtils.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemUtils.java
@@ -29,19 +29,18 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.management.ManagementFactory;
import java.lang.reflect.Method;
+import java.math.BigDecimal;
import java.util.Properties;
import java.util.StringTokenizer;
+import static java.lang.Character.isDigit;
import static java.lang.Thread.currentThread;
import static org.apache.commons.io.IOUtils.closeQuietly;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.JavaVersion.JAVA_RECENT;
import static org.apache.commons.lang3.StringUtils.isNumeric;
import static org.apache.commons.lang3.SystemUtils.IS_OS_FREE_BSD;
import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX;
import static org.apache.commons.lang3.SystemUtils.IS_OS_NET_BSD;
import static org.apache.commons.lang3.SystemUtils.IS_OS_OPEN_BSD;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
import static org.apache.maven.surefire.util.ReflectionUtils.invokeMethodChain;
import static org.apache.maven.surefire.util.ReflectionUtils.tryLoadClass;
import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
@@ -54,7 +53,11 @@ import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull
*/
public final class SystemUtils
{
- private static final double JIGSAW_JAVA_VERSION = 9.0d;
+ public static final BigDecimal JAVA_SPECIFICATION_VERSION = getJavaSpecificationVersion();
+
+ private static final BigDecimal JAVA_VERSION_7 = new BigDecimal( "1.7" );
+
+ private static final BigDecimal JIGSAW_JAVA_VERSION = new BigDecimal( 9 );
private static final int PROC_STATUS_PID_FIRST_CHARS = 20;
@@ -127,7 +130,7 @@ public final class SystemUtils
return "jre".equals( pathToJreOrJdk.getName() ) ? pathToJreOrJdk.getParentFile() : pathToJreOrJdk;
}
- public static Double toJdkVersionFromReleaseFile( File jdkHome )
+ public static BigDecimal toJdkVersionFromReleaseFile( File jdkHome )
{
File release = new File( requireNonNull( jdkHome ).getAbsoluteFile(), "release" );
if ( !release.isFile() )
@@ -158,7 +161,7 @@ public final class SystemUtils
return null;
}
- return Double.valueOf( javaVersion );
+ return new BigDecimal( javaVersion );
}
catch ( IOException e )
{
@@ -170,6 +173,43 @@ public final class SystemUtils
}
}
+ /**
+ * Safely extracts major and minor version as fractional number from
+ * <pre>
+ * $MAJOR.$MINOR.$SECURITY
+ * </pre>.
+ * <br>
+ * The security version is usually not needed to know.
+ * It can be applied to not certified JRE.
+ *
+ * @return major.minor version derived from java specification version of <em>this</em> JVM, e.g. 1.8, 9, etc.
+ */
+ private static BigDecimal getJavaSpecificationVersion()
+ {
+ StringBuilder fractionalVersion = new StringBuilder( "0" );
+ for ( char c : org.apache.commons.lang3.SystemUtils.JAVA_SPECIFICATION_VERSION.toCharArray() )
+ {
+ if ( isDigit( c ) )
+ {
+ fractionalVersion.append( c );
+ }
+ else if ( c == '.' )
+ {
+ if ( fractionalVersion.indexOf( "." ) == -1 )
+ {
+ fractionalVersion.append( '.' );
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ String majorMinorVersion = fractionalVersion.toString();
+ return new BigDecimal( majorMinorVersion.endsWith( "." ) ? majorMinorVersion + "0" : majorMinorVersion )
+ .stripTrailingZeros();
+ }
+
public static boolean isJava9AtLeast( String jvmExecutablePath )
{
File externalJavaHome = toJdkHomeFromJvmExec( jvmExecutablePath );
@@ -178,23 +218,32 @@ public final class SystemUtils
{
return isBuiltInJava9AtLeast();
}
- Double releaseFileVersion = externalJavaHome == null ? null : toJdkVersionFromReleaseFile( externalJavaHome );
- return SystemUtils.isJava9AtLeast( releaseFileVersion );
+ else
+ {
+ BigDecimal releaseFileVersion =
+ externalJavaHome == null ? null : toJdkVersionFromReleaseFile( externalJavaHome );
+ return isJava9AtLeast( releaseFileVersion );
+ }
+ }
+
+ public static boolean isBuiltInJava9AtLeast()
+ {
+ return JAVA_SPECIFICATION_VERSION.compareTo( JIGSAW_JAVA_VERSION ) >= 0;
}
- static boolean isBuiltInJava9AtLeast()
+ public static boolean isBuiltInJava7AtLeast()
{
- return isJavaVersionAtLeast( JAVA_9 );
+ return JAVA_SPECIFICATION_VERSION.compareTo( JAVA_VERSION_7 ) >= 0;
}
- public static boolean isJava9AtLeast( Double version )
+ public static boolean isJava9AtLeast( BigDecimal version )
{
- return version != null && version >= JIGSAW_JAVA_VERSION;
+ return version != null && version.compareTo( JIGSAW_JAVA_VERSION ) >= 0;
}
public static ClassLoader platformClassLoader()
{
- if ( JAVA_RECENT.atLeast( JAVA_9 ) )
+ if ( isBuiltInJava9AtLeast() )
{
return reflectClassLoader( ClassLoader.class, "getPlatformClassLoader" );
}
@@ -203,7 +252,7 @@ public final class SystemUtils
public static Long pid()
{
- if ( JAVA_RECENT.atLeast( JAVA_9 ) )
+ if ( isBuiltInJava9AtLeast() )
{
Long pid = pidOnJava9();
if ( pid != null )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SystemUtilsTest.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SystemUtilsTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SystemUtilsTest.java
index 094a418..d1ba04f 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SystemUtilsTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SystemUtilsTest.java
@@ -22,13 +22,13 @@ package org.apache.maven.surefire.booter;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
-import org.mockito.Mockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.io.File;
import java.io.IOException;
import java.lang.management.ManagementFactory;
+import java.math.BigDecimal;
import static java.io.File.separator;
import static org.apache.commons.lang3.JavaVersion.JAVA_9;
@@ -40,12 +40,12 @@ import static org.apache.commons.lang3.SystemUtils.IS_OS_OPEN_BSD;
import static org.fest.assertions.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;
import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyDouble;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.verifyStatic;
+import static org.powermock.reflect.Whitebox.invokeMethod;
/**
* Test of {@link SystemUtils}.
@@ -60,6 +60,15 @@ public class SystemUtilsTest
{
@Test
+ public void shouldMatchJavaSpecVersion() throws Exception
+ {
+ BigDecimal actual = invokeMethod( SystemUtils.class, "getJavaSpecificationVersion" );
+ BigDecimal expected = new BigDecimal( System.getProperty( "java.specification.version" ) );
+ assertThat( actual ).isEqualTo( expected );
+ assertThat( SystemUtils.JAVA_SPECIFICATION_VERSION ).isEqualTo( expected );
+ }
+
+ @Test
public void shouldParseProprietaryReleaseFile() throws IOException
{
String classes = new File( "." ).getCanonicalPath() + separator + "target" + separator + "test-classes";
@@ -169,9 +178,9 @@ public class SystemUtilsTest
@Test
public void shouldBeJavaVersion()
{
- assertThat( SystemUtils.isJava9AtLeast( (Double) null ) ).isFalse();
- assertThat( SystemUtils.isJava9AtLeast( 1.8d ) ).isFalse();
- assertThat( SystemUtils.isJava9AtLeast( 9.0d ) ).isTrue();
+ assertThat( SystemUtils.isJava9AtLeast( (BigDecimal ) null ) ).isFalse();
+ assertThat( SystemUtils.isJava9AtLeast( new BigDecimal( "1.8" ) ) ).isFalse();
+ assertThat( SystemUtils.isJava9AtLeast( new BigDecimal( 9 ) ) ).isTrue();
}
@Test
@@ -328,7 +337,7 @@ public class SystemUtilsTest
when( SystemUtils.toJdkVersionFromReleaseFile( any( File.class ) ) )
.thenCallRealMethod();
- when( SystemUtils.isJava9AtLeast( anyDouble() ) )
+ when( SystemUtils.isJava9AtLeast( any( BigDecimal.class ) ) )
.thenCallRealMethod();
if ( JAVA_RECENT.atLeast( JAVA_9 ) )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
index c2d0173..5063a2d 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
@@ -29,8 +29,6 @@ import java.io.InputStream;
import java.util.Properties;
import java.util.StringTokenizer;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.JavaVersion.JAVA_RECENT;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
@@ -52,7 +50,7 @@ public abstract class AbstractJigsawIT
protected SurefireLauncher assumeJigsaw() throws IOException
{
assumeTrue( "There's no JDK 9 provided.",
- JAVA_RECENT.atLeast( JAVA_9 ) || JDK_HOME != null && isExtJava9AtLeast() );
+ isJavaVersion9AtLeast() || JDK_HOME != null && isExtJavaVerion9AtLeast() );
// fail( JDK_HOME_KEY + " was provided with value " + JDK_HOME + " but it is not Jigsaw Java 9." );
SurefireLauncher launcher = unpack();
@@ -67,7 +65,7 @@ public abstract class AbstractJigsawIT
protected SurefireLauncher assumeJava9Property() throws IOException
{
- assumeTrue( "There's no JDK 9 provided.", JDK_HOME != null && isExtJava9AtLeast() );
+ assumeTrue( "There's no JDK 9 provided.", JDK_HOME != null && isExtJavaVerion9AtLeast() );
return unpack();
}
@@ -76,7 +74,12 @@ public abstract class AbstractJigsawIT
return unpack( getProjectDirectoryName() );
}
- private static boolean isExtJava9AtLeast() throws IOException
+ private static boolean isJavaVersion9AtLeast()
+ {
+ return Double.valueOf( System.getProperty( "java.specification.version" ) ) >= JIGSAW_JAVA_VERSION;
+ }
+
+ private static boolean isExtJavaVerion9AtLeast() throws IOException
{
File release = new File( JDK_HOME, "release" );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java
index 9c223ea..2c618d0 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java
@@ -19,7 +19,6 @@ package org.apache.maven.surefire.its;
* under the License.
*/
-import org.apache.commons.lang3.JavaVersion;
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.apache.maven.surefire.its.fixture.SurefireLauncher;
import org.junit.Test;
@@ -29,8 +28,6 @@ import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_5;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
import static org.junit.runners.Parameterized.Parameter;
import static org.junit.runners.Parameterized.Parameters;
@@ -49,10 +46,10 @@ public class CheckTestNgListenerReporterIT
public static Collection<Object[]> data()
{
return Arrays.asList(new Object[][] {
- { "5.6", "jdk15", JAVA_1_5 }, // First TestNG version with reporter support
- { "5.7", "jdk15", JAVA_1_5 }, // default version from pom of the test case
- { "5.10", "jdk15", JAVA_1_5 },
- { "5.13", null, JAVA_1_5 }, // "reporterslist" param becomes String instead of List<ReporterConfig>
+ { "5.6", "jdk15", 1.5d }, // First TestNG version with reporter support
+ { "5.7", "jdk15", 1.5d }, // default version from pom of the test case
+ { "5.10", "jdk15", 1.5d },
+ { "5.13", null, 1.5d }, // "reporterslist" param becomes String instead of List<ReporterConfig>
// "listener" param becomes String instead of List<Class>
// configure(Map) in 5.14.1 and 5.14.2 is transforming List<Class> into a String with a space as separator.
@@ -71,10 +68,10 @@ public class CheckTestNgListenerReporterIT
//{ "5.14.4", null, "1.5" }, { "5.14.5", null, "1.5" }, // Fails: not able to test due to system dependency org.testng:guice missed the path and use to break CI
// ClassNotFoundException: com.beust.jcommander.ParameterException
- { "5.14.6", null, JAVA_1_5 }, // Usage of org.testng:guice removed
- { "5.14.9", null, JAVA_1_5 }, // Latest 5.14.x TestNG version
- { "6.0", null, JAVA_1_5 },
- { "6.9.9", null, JAVA_1_7 } // Currently latest TestNG version
+ { "5.14.6", null, 1.5d }, // Usage of org.testng:guice removed
+ { "5.14.9", null, 1.5d }, // Latest 5.14.x TestNG version
+ { "6.0", null, 1.5d },
+ { "6.9.9", null, 1.7d } // Currently latest TestNG version
});
}
@@ -85,7 +82,7 @@ public class CheckTestNgListenerReporterIT
public String classifier;
@Parameter(2)
- public JavaVersion javaVersion;
+ public double javaVersion;
@Test
public void testNgListenerReporter()
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
index 4bb1842..38c2eae 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
@@ -23,7 +23,6 @@ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.junit.Before;
import org.junit.Test;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_6;
import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
/**
@@ -41,7 +40,7 @@ public class JUnit47WithCucumberIT
@Before
public void assumeJdk16()
{
- assumeJavaVersion( JAVA_1_6 );
+ assumeJavaVersion( 1.6d );
}
@Test
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
index 17e52a6..ed0d40c 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
@@ -18,8 +18,6 @@ package org.apache.maven.surefire.its.fixture;
* under the License.
*/
-import org.apache.commons.lang3.JavaVersion;
-import org.apache.commons.lang3.SystemUtils;
import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
import org.apache.maven.plugin.surefire.log.api.PrintStreamLogger;
import org.apache.maven.plugins.surefire.report.ReportTestSuite;
@@ -32,7 +30,6 @@ import java.util.Locale;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
-import static org.apache.commons.lang3.SystemUtils.JAVA_SPECIFICATION_VERSION;
import static org.junit.Assume.assumeTrue;
@SuppressWarnings( { "JavaDoc" } )
@@ -168,9 +165,10 @@ public class HelperAssertions
}
}
- public static void assumeJavaVersion( JavaVersion version )
+ public static void assumeJavaVersion( double expectedVersion )
{
- assumeTrue( "java.specification.version: " + JAVA_SPECIFICATION_VERSION,
- SystemUtils.isJavaVersionAtLeast( version ) );
+ String thisVersion = System.getProperty( "java.specification.version" );
+ assumeTrue( "java.specification.version: " + thisVersion,
+ Double.valueOf( thisVersion ) >= expectedVersion );
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
index a99e636..8c2c213 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
@@ -24,7 +24,6 @@ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.apache.maven.surefire.its.fixture.SurefireLauncher;
import org.junit.Test;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
@@ -43,7 +42,7 @@ public class Surefire1177TestngParallelSuitesIT
public void shouldRunTwoSuitesInParallel()
throws VerificationException
{
- assumeJavaVersion( JAVA_1_7 );
+ assumeJavaVersion( 1.7d );
unpack().executeTest()
.verifyErrorFree( 2 )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb5173d0/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1211JUnitTestNgIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1211JUnitTestNgIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1211JUnitTestNgIT.java
index 27b4da8..53cd764 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1211JUnitTestNgIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1211JUnitTestNgIT.java
@@ -23,7 +23,6 @@ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.apache.maven.surefire.its.fixture.SurefireLauncher;
import org.junit.Test;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
/**
@@ -38,7 +37,7 @@ public class Surefire1211JUnitTestNgIT
@Test
public void withJUnit()
{
- assumeJavaVersion( JAVA_1_7 );
+ assumeJavaVersion( 1.7d );
unpack().threadCount( 1 )
.executeTest()
@@ -48,7 +47,7 @@ public class Surefire1211JUnitTestNgIT
@Test
public void withoutJUnit()
{
- assumeJavaVersion( JAVA_1_7 );
+ assumeJavaVersion( 1.7d );
unpack().threadCount( 1 )
.sysProp( "junit", "false" )