Skip to content

Commit 74c07d3

Browse files
committed
Removed JavaVersion checks from spring-core tests (for JDK 9 compatibility)
Issue: SPR-13344
1 parent 182b1e9 commit 74c07d3

File tree

3 files changed

+7
-129
lines changed

3 files changed

+7
-129
lines changed

spring-core/src/test/java/org/springframework/tests/Assume.java

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
2121
import java.util.Set;
2222

2323
import org.apache.commons.logging.Log;
24-
2524
import org.junit.AssumptionViolatedException;
2625

2726
import org.springframework.util.ClassUtils;
@@ -33,38 +32,8 @@
3332
* conditions hold {@code true}. If the assumption fails, it means the test should be
3433
* skipped.
3534
*
36-
* <p>For example, if a set of tests require at least JDK 1.7 it can use
37-
* {@code Assume#atLeast(JavaVersion.JAVA_17)} as shown below:
38-
*
39-
* <pre class="code">
40-
* public void MyTests {
41-
*
42-
* &#064;BeforeClass
43-
* public static void assumptions() {
44-
* Assume.atLeast(JavaVersion.JAVA_17);
45-
* }
46-
*
47-
* // ... all the test methods that require at least JDK 1.7
48-
* }
49-
* </pre>
50-
*
51-
* If only a single test requires at least JDK 1.7 it can use the
52-
* {@code Assume#atLeast(JavaVersion.JAVA_17)} as shown below:
53-
*
54-
* <pre class="code">
55-
* public void MyTests {
56-
*
57-
* &#064;Test
58-
* public void requiresJdk17 {
59-
* Assume.atLeast(JavaVersion.JAVA_17);
60-
* // ... perform the actual test
61-
* }
62-
* }
63-
* </pre>
64-
*
65-
* In addition to assumptions based on the JDK version, tests can be categorized into
66-
* {@link TestGroup}s. Active groups are enabled using the 'testGroups' system property,
67-
* usually activated from the gradle command line:
35+
* Tests can be categorized into {@link TestGroup}s. Active groups are enabled using
36+
* the 'testGroups' system property, usually activated from the gradle command line:
6837
* <pre>
6938
* gradle test -PtestGroups="performance"
7039
* </pre>
@@ -76,7 +45,6 @@
7645
* @author Phillip Webb
7746
* @author Sam Brannen
7847
* @since 3.2
79-
* @see #atLeast(JavaVersion)
8048
* @see #group(TestGroup)
8149
* @see #group(TestGroup, Executable)
8250
*/
@@ -85,27 +53,14 @@ public abstract class Assume {
8553
private static final Set<TestGroup> GROUPS = TestGroup.parse(System.getProperty("testGroups"));
8654

8755

88-
/**
89-
* Assume that a minimum {@link JavaVersion} is running.
90-
* @param version the minimum version for the test to run
91-
* @throws AssumptionViolatedException if the assumption fails
92-
*/
93-
public static void atLeast(JavaVersion version) {
94-
if (!JavaVersion.runningVersion().isAtLeast(version)) {
95-
throw new AssumptionViolatedException("Requires JDK " + version + " but running "
96-
+ JavaVersion.runningVersion());
97-
}
98-
}
99-
10056
/**
10157
* Assume that a particular {@link TestGroup} has been specified.
10258
* @param group the group that must be specified
10359
* @throws AssumptionViolatedException if the assumption fails
10460
*/
10561
public static void group(TestGroup group) {
10662
if (!GROUPS.contains(group)) {
107-
throw new AssumptionViolatedException("Requires unspecified group " + group
108-
+ " from " + GROUPS);
63+
throw new AssumptionViolatedException("Requires unspecified group " + group + " from " + GROUPS);
10964
}
11065
}
11166

@@ -154,11 +109,13 @@ public static void canLoadNativeDirFonts() {
154109
}
155110
}
156111

112+
157113
/**
158114
* @since 4.2
159115
*/
160116
@FunctionalInterface
161-
public static interface Executable {
117+
public interface Executable {
118+
162119
void execute() throws Exception;
163120
}
164121

spring-core/src/test/java/org/springframework/tests/BuildTests.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

spring-core/src/test/java/org/springframework/tests/JavaVersionTests.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)