diff --git a/spring-core/src/test/java/org/springframework/tests/Assume.java b/spring-core/src/test/java/org/springframework/tests/Assume.java index e7923851a5a..c0be2720894 100644 --- a/spring-core/src/test/java/org/springframework/tests/Assume.java +++ b/spring-core/src/test/java/org/springframework/tests/Assume.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.lang.reflect.Method; import java.util.Set; import org.apache.commons.logging.Log; - import org.junit.AssumptionViolatedException; import org.springframework.util.ClassUtils; @@ -33,38 +32,8 @@ import static org.junit.Assume.*; * conditions hold {@code true}. If the assumption fails, it means the test should be * skipped. * - *

For example, if a set of tests require at least JDK 1.7 it can use - * {@code Assume#atLeast(JavaVersion.JAVA_17)} as shown below: - * - *

- * public void MyTests {
- *
- *   @BeforeClass
- *   public static void assumptions() {
- *       Assume.atLeast(JavaVersion.JAVA_17);
- *   }
- *
- *   // ... all the test methods that require at least JDK 1.7
- * }
- * 
- * - * If only a single test requires at least JDK 1.7 it can use the - * {@code Assume#atLeast(JavaVersion.JAVA_17)} as shown below: - * - *
- * public void MyTests {
- *
- *   @Test
- *   public void requiresJdk17 {
- *       Assume.atLeast(JavaVersion.JAVA_17);
- *       // ... perform the actual test
- *   }
- * }
- * 
- * - * In addition to assumptions based on the JDK version, tests can be categorized into - * {@link TestGroup}s. Active groups are enabled using the 'testGroups' system property, - * usually activated from the gradle command line: + * Tests can be categorized into {@link TestGroup}s. Active groups are enabled using + * the 'testGroups' system property, usually activated from the gradle command line: *
  * gradle test -PtestGroups="performance"
  * 
@@ -76,7 +45,6 @@ import static org.junit.Assume.*; * @author Phillip Webb * @author Sam Brannen * @since 3.2 - * @see #atLeast(JavaVersion) * @see #group(TestGroup) * @see #group(TestGroup, Executable) */ @@ -85,18 +53,6 @@ public abstract class Assume { private static final Set GROUPS = TestGroup.parse(System.getProperty("testGroups")); - /** - * Assume that a minimum {@link JavaVersion} is running. - * @param version the minimum version for the test to run - * @throws AssumptionViolatedException if the assumption fails - */ - public static void atLeast(JavaVersion version) { - if (!JavaVersion.runningVersion().isAtLeast(version)) { - throw new AssumptionViolatedException("Requires JDK " + version + " but running " - + JavaVersion.runningVersion()); - } - } - /** * Assume that a particular {@link TestGroup} has been specified. * @param group the group that must be specified @@ -104,8 +60,7 @@ public abstract class Assume { */ public static void group(TestGroup group) { if (!GROUPS.contains(group)) { - throw new AssumptionViolatedException("Requires unspecified group " + group - + " from " + GROUPS); + throw new AssumptionViolatedException("Requires unspecified group " + group + " from " + GROUPS); } } @@ -154,11 +109,13 @@ public abstract class Assume { } } + /** * @since 4.2 */ @FunctionalInterface - public static interface Executable { + public interface Executable { + void execute() throws Exception; } diff --git a/spring-core/src/test/java/org/springframework/tests/BuildTests.java b/spring-core/src/test/java/org/springframework/tests/BuildTests.java deleted file mode 100644 index ee704806f2e..00000000000 --- a/spring-core/src/test/java/org/springframework/tests/BuildTests.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.tests; - -import org.junit.Test; - -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - -/** - * General build related tests. Part of spring-core to ensure that they run early in the - * build process. - */ -public class BuildTests { - - @Test - public void javaVersion() throws Exception { - Assume.group(TestGroup.CI); - assertThat("Java Version", JavaVersion.runningVersion(), equalTo(JavaVersion.JAVA_18)); - } - -} diff --git a/spring-core/src/test/java/org/springframework/tests/JavaVersionTests.java b/spring-core/src/test/java/org/springframework/tests/JavaVersionTests.java deleted file mode 100644 index 05c341fb94d..00000000000 --- a/spring-core/src/test/java/org/springframework/tests/JavaVersionTests.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002-2015 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.tests; - -import org.junit.Test; - -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - -/** - * Tests for {@link JavaVersion}. - * - * @author Phillip Webb - */ -public class JavaVersionTests { - - @Test - public void runningVersion() { - assertNotNull(JavaVersion.runningVersion()); - assertThat(System.getProperty("java.version"), startsWith(JavaVersion.runningVersion().toString())); - } - - @Test - public void isAtLeast() throws Exception { - assertTrue(JavaVersion.JAVA_16.isAtLeast(JavaVersion.JAVA_16)); - assertFalse(JavaVersion.JAVA_16.isAtLeast(JavaVersion.JAVA_17)); - } - -}