* - If you do not wish for your test classes to be tied to a Spring-specific
* class hierarchy, you may configure your own custom test classes by using
- * {@link SpringJUnit4ClassRunner}, {@link ContextConfiguration @ContextConfiguration},
+ * {@link SpringRunner}, {@link ContextConfiguration @ContextConfiguration},
* {@link TestExecutionListeners @TestExecutionListeners}, etc.
* - If you wish to extend this class and use a runner other than the
- * {@link SpringJUnit4ClassRunner}, as of Spring Framework 4.2 you can use
+ * {@link SpringRunner}, as of Spring Framework 4.2 you can use
* {@link org.springframework.test.context.junit4.rules.SpringClassRule SpringClassRule} and
* {@link org.springframework.test.context.junit4.rules.SpringMethodRule SpringMethodRule}
* and specify your runner of choice via {@link org.junit.runner.RunWith @RunWith(...)}.
diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.java b/spring-test/src/main/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.java
index 3cc11b59a02..a0ed3db9c20 100644
--- a/spring-test/src/main/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.java
+++ b/spring-test/src/main/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.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.
@@ -56,6 +56,9 @@ import org.springframework.util.ReflectionUtils;
* Spring TestContext Framework to standard JUnit tests by means of the
* {@link TestContextManager} and associated support classes and annotations.
*
+ * To use this class, simply annotate a JUnit 4 based test class with
+ * {@code @RunWith(SpringJUnit4ClassRunner.class)} or {@code @RunWith(SpringRunner.class)}.
+ *
*
The following list constitutes all annotations currently supported directly
* or indirectly by {@code SpringJUnit4ClassRunner}. (Note that additional
* annotations may be supported by various
@@ -81,6 +84,7 @@ import org.springframework.util.ReflectionUtils;
* @author Sam Brannen
* @author Juergen Hoeller
* @since 2.5
+ * @see SpringRunner
* @see TestContextManager
* @see AbstractJUnit4SpringContextTests
* @see AbstractTransactionalJUnit4SpringContextTests
diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/SpringRunner.java b/spring-test/src/main/java/org/springframework/test/context/junit4/SpringRunner.java
new file mode 100644
index 00000000000..4c80304eb63
--- /dev/null
+++ b/spring-test/src/main/java/org/springframework/test/context/junit4/SpringRunner.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ * 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.test.context.junit4;
+
+import org.junit.runners.model.InitializationError;
+
+/**
+ * {@code SpringRunner} is an alias for the {@link SpringJUnit4ClassRunner}.
+ *
+ * To use this class, simply annotate a JUnit 4 based test class with
+ * {@code @RunWith(SpringRunner.class)}.
+ *
+ *
If you would like to use the Spring TestContext Framework with a runner other than
+ * this one, use {@link org.springframework.test.context.junit4.rules.SpringClassRule SpringClassRule}
+ * and {@link org.springframework.test.context.junit4.rules.SpringMethodRule SpringMethodRule}.
+ *
+ *
NOTE: This class requires JUnit 4.12 or higher.
+ *
+ * @author Sam Brannen
+ * @since 4.3
+ * @see SpringJUnit4ClassRunner
+ * @see org.springframework.test.context.junit4.rules.SpringClassRule
+ * @see org.springframework.test.context.junit4.rules.SpringMethodRule
+ */
+public final class SpringRunner extends SpringJUnit4ClassRunner {
+
+ /**
+ * Construct a new {@code SpringRunner} and initialize a
+ * {@link org.springframework.test.context.TestContextManager TestContextManager}
+ * to provide Spring testing functionality to standard JUnit 4 tests.
+ * @param clazz the test class to be run
+ * @see #createTestContextManager(Class)
+ */
+ public SpringRunner(Class> clazz) throws InitializationError {
+ super(clazz);
+ }
+
+}
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/AbstractTransactionalSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/AbstractTransactionalSpringRunnerTests.java
index 493be806d2e..5760755fa17 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/AbstractTransactionalSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/AbstractTransactionalSpringRunnerTests.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.
@@ -32,7 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
* @see MethodLevelTransactionalSpringRunnerTests
* @see Transactional
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@ContextConfiguration("transactionalTests-context.xml")
public abstract class AbstractTransactionalSpringRunnerTests {
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelDisabledSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelDisabledSpringRunnerTests.java
index b55abdaa894..2db442a9367 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelDisabledSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelDisabledSpringRunnerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 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.
@@ -30,7 +30,7 @@ import static org.junit.Assert.*;
* @author Juergen Hoeller
* @author Sam Brannen
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@TestExecutionListeners(ClassLevelDisabledSpringRunnerTests.CustomTestExecutionListener.class)
@IfProfileValue(name = "ClassLevelDisabledSpringRunnerTests.profile_value.name", value = "enigmaX")
public class ClassLevelDisabledSpringRunnerTests {
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java
index 8f29a2d0148..5eb8c8edae4 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.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.
@@ -41,7 +41,7 @@ import static org.springframework.test.transaction.TransactionTestUtils.*;
* {@link Transactional @Transactional}, {@link TestExecutionListeners
* @TestExecutionListeners}, and {@link ContextConfiguration
* @ContextConfiguration} annotations in conjunction with the
- * {@link SpringJUnit4ClassRunner} and the following
+ * {@link SpringRunner} and the following
* {@link TestExecutionListener TestExecutionListeners}:
*
*
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java
index aab80b71efa..be8a2ff9755 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 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.
@@ -37,7 +37,7 @@ import static org.junit.Assert.*;
* @author Sam Brannen
* @since 3.0
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@BootstrapWith(CustomDefaultContextLoaderClassSpringRunnerTests.PropertiesBasedTestContextBootstrapper.class)
@ContextConfiguration("PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests-context.properties")
public class CustomDefaultContextLoaderClassSpringRunnerTests {
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackFalseRollbackAnnotationTransactionalTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackFalseRollbackAnnotationTransactionalTests.java
index 0c1f043aef4..1b027899a26 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackFalseRollbackAnnotationTransactionalTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackFalseRollbackAnnotationTransactionalTests.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.
@@ -45,7 +45,7 @@ import static org.springframework.test.transaction.TransactionTestUtils.*;
* @see Transactional#transactionManager
* @see DefaultRollbackFalseTransactionalTests
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@ContextConfiguration(classes = EmbeddedPersonDatabaseTestsConfig.class, inheritLocations = false)
@Transactional("txMgr")
@Rollback(false)
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackTrueRollbackAnnotationTransactionalTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackTrueRollbackAnnotationTransactionalTests.java
index 984fc62fd32..49f70f6da14 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackTrueRollbackAnnotationTransactionalTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/DefaultRollbackTrueRollbackAnnotationTransactionalTests.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.
@@ -45,7 +45,7 @@ import static org.springframework.test.transaction.TransactionTestUtils.*;
* @see Transactional#transactionManager
* @see DefaultRollbackTrueTransactionalTests
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@ContextConfiguration(classes = EmbeddedPersonDatabaseTestsConfig.class, inheritLocations = false)
@Transactional("txMgr")
@Rollback(true)
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java
index a445fcaf64c..f4e849966d2 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 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.
@@ -34,7 +34,7 @@ import static org.junit.Assert.*;
* {@link IfProfileValue @IfProfileValue} and
* {@link ProfileValueSourceConfiguration @ProfileValueSourceConfiguration}
* (with the implicit, default {@link ProfileValueSource}) annotations in
- * conjunction with the {@link SpringJUnit4ClassRunner}.
+ * conjunction with the {@link SpringRunner}.
*
* Note that {@link TestExecutionListeners @TestExecutionListeners} is
* explicitly configured with an empty list, thus disabling all default
@@ -44,7 +44,7 @@ import static org.junit.Assert.*;
* @since 2.5
* @see HardCodedProfileValueSourceSpringRunnerTests
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@TestExecutionListeners( {})
public class EnabledAndIgnoredSpringRunnerTests {
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ExpectedExceptionSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ExpectedExceptionSpringRunnerTests.java
index 5fc3947d9c7..4cfb46994ae 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/ExpectedExceptionSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ExpectedExceptionSpringRunnerTests.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.
@@ -29,7 +29,7 @@ import static org.springframework.test.context.junit4.JUnitTestingUtils.*;
/**
* Verifies proper handling of JUnit's {@link Test#expected() @Test(expected=...)}
- * support in conjunction with the {@link SpringJUnit4ClassRunner}.
+ * support in conjunction with the {@link SpringRunner}.
*
* @author Sam Brannen
* @since 3.0
@@ -39,7 +39,7 @@ public class ExpectedExceptionSpringRunnerTests {
@Test
public void expectedExceptions() throws Exception {
- runTestsAndAssertCounters(SpringJUnit4ClassRunner.class, ExpectedExceptionSpringRunnerTestCase.class, 1, 0, 1, 0, 0);
+ runTestsAndAssertCounters(SpringRunner.class, ExpectedExceptionSpringRunnerTestCase.class, 1, 0, 1, 0, 0);
}
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsJUnitTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsJUnitTests.java
index daebe2bc88d..4918606f647 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsJUnitTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsJUnitTests.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.
@@ -79,7 +79,7 @@ public class FailingBeforeAndAfterMethodsJUnitTests {
}
protected Class extends Runner> getRunnerClass() {
- return SpringJUnit4ClassRunner.class;
+ return SpringRunner.class;
}
@Test
@@ -133,7 +133,7 @@ public class FailingBeforeAndAfterMethodsJUnitTests {
}
}
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@TestExecutionListeners({})
public static abstract class BaseTestCase {
@@ -168,7 +168,7 @@ public class FailingBeforeAndAfterMethodsJUnitTests {
}
@Ignore("TestCase classes are run manually by the enclosing test class")
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration("FailingBeforeAndAfterMethodsTests-context.xml")
@Transactional
public static class FailingBeforeTransactionTestCase {
@@ -184,7 +184,7 @@ public class FailingBeforeAndAfterMethodsJUnitTests {
}
@Ignore("TestCase classes are run manually by the enclosing test class")
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration("FailingBeforeAndAfterMethodsTests-context.xml")
@Transactional
public static class FailingAfterTransactionTestCase {
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java
index 9a26751fcb3..b0e18843fee 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 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.
@@ -28,7 +28,7 @@ import org.springframework.test.annotation.ProfileValueSourceConfiguration;
* @IfProfileValue} and {@link ProfileValueSourceConfiguration
* @ProfileValueSourceConfiguration} (with an
* explicit, custom defined {@link ProfileValueSource}) annotations in
- * conjunction with the {@link SpringJUnit4ClassRunner}.
+ * conjunction with the {@link SpringRunner}.
*
*
* @author Sam Brannen
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java
index 42700595794..f9b6b749466 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.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.
@@ -40,7 +40,7 @@ import static org.springframework.test.transaction.TransactionTestUtils.*;
* {@link Transactional @Transactional}, {@link TestExecutionListeners
* @TestExecutionListeners}, and {@link ContextConfiguration
* @ContextConfiguration} annotations in conjunction with the
- * {@link SpringJUnit4ClassRunner} and the following
+ * {@link SpringRunner} and the following
* {@link TestExecutionListener TestExecutionListeners}:
*
*
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java
index acbb6cc23f3..b52a9fa188e 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 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.
@@ -32,7 +32,7 @@ import static org.junit.Assert.*;
/**
*
* JUnit 4 based test class, which verifies the expected functionality of
- * {@link SpringJUnit4ClassRunner} in conjunction with support for application contexts
+ * {@link SpringRunner} in conjunction with support for application contexts
* loaded from Java {@link Properties} files. Specifically, the
* {@link ContextConfiguration#loader() loader} attribute of {@code ContextConfiguration}
* and the
@@ -54,7 +54,7 @@ import static org.junit.Assert.*;
* @see GenericPropertiesContextLoader
* @see SpringJUnit4ClassRunnerAppCtxTests
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@ContextConfiguration(loader = GenericPropertiesContextLoader.class)
public class PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests {
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/RepeatedSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/RepeatedSpringRunnerTests.java
index 94a884bfb44..d2bf46bf1a0 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/RepeatedSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/RepeatedSpringRunnerTests.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.
@@ -38,7 +38,7 @@ import static org.springframework.test.context.junit4.JUnitTestingUtils.*;
/**
* Verifies proper handling of the following in conjunction with the
- * {@link SpringJUnit4ClassRunner}:
+ * {@link SpringRunner}:
*
* - Spring's {@link Repeat @Repeat}
* - Spring's {@link Timed @Timed}
@@ -82,7 +82,7 @@ public class RepeatedSpringRunnerTests {
}
protected Class extends Runner> getRunnerClass() {
- return SpringJUnit4ClassRunner.class;
+ return SpringRunner.class;
}
@Test
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java
index 6f0eddff3c0..e59cdde90a5 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 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.
@@ -27,14 +27,14 @@ import static org.junit.Assert.*;
/**
* Verifies support for JUnit 4.7 {@link Rule Rules} in conjunction with the
- * {@link SpringJUnit4ClassRunner}. The body of this test class is taken from
- * the JUnit 4.7 release notes.
+ * {@link SpringRunner}. The body of this test class is taken from the
+ * JUnit 4.7 release notes.
*
* @author JUnit 4.7 Team
* @author Sam Brannen
* @since 3.0
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@TestExecutionListeners( {})
public class SpringJUnit47ClassRunnerRuleTests {
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java
index 292aebfca14..c60745d394a 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.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.
@@ -43,7 +43,7 @@ import static org.junit.Assert.*;
/**
* SpringJUnit4ClassRunnerAppCtxTests serves as a proof of concept
* JUnit 4 based test class, which verifies the expected functionality of
- * {@link SpringJUnit4ClassRunner} in conjunction with the following:
+ * {@link SpringRunner} in conjunction with the following:
*
*
* - {@link ContextConfiguration @ContextConfiguration}
@@ -73,7 +73,7 @@ import static org.junit.Assert.*;
* @see RelativePathSpringJUnit4ClassRunnerAppCtxTests
* @see InheritedConfigSpringJUnit4ClassRunnerAppCtxTests
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@ContextConfiguration
@TestExecutionListeners(DependencyInjectionTestExecutionListener.class)
public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAware, BeanNameAware, InitializingBean {
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4TestSuite.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4TestSuite.java
index 8f301117883..020bda60dea 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4TestSuite.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4TestSuite.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.
@@ -45,12 +45,12 @@ import org.springframework.test.context.junit4.profile.xml.DevProfileXmlConfigTe
import org.springframework.test.context.transaction.programmatic.ProgrammaticTxMgmtTests;
/**
- * JUnit test suite for tests involving {@link SpringJUnit4ClassRunner} and the
+ * JUnit test suite for tests involving {@link SpringRunner} and the
* Spring TestContext Framework; only intended to be run manually as a
* convenience.
*
* This test suite serves a dual purpose of verifying that tests run with
- * {@link SpringJUnit4ClassRunner} can be used in conjunction with JUnit's
+ * {@link SpringRunner} can be used in conjunction with JUnit's
* {@link Suite} runner.
*
*
Note that tests included in this suite will be executed at least twice if
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java
index 4dd270ca7c8..f4cda4ea10f 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 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.
@@ -22,7 +22,7 @@ import org.springframework.test.context.TestExecutionListeners;
/**
*
- * Simple unit test to verify that {@link SpringJUnit4ClassRunner} does not
+ * Simple unit test to verify that {@link SpringRunner} does not
* hinder correct functionality of standard JUnit 4.4+ testing features.
*
*
@@ -35,7 +35,7 @@ import org.springframework.test.context.TestExecutionListeners;
* @since 2.5
* @see StandardJUnit4FeaturesTests
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@TestExecutionListeners({})
public class StandardJUnit4FeaturesSpringRunnerTests extends StandardJUnit4FeaturesTests {
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java
index d59bc140096..cede912c642 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.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.
@@ -32,7 +32,7 @@ import static org.springframework.test.context.junit4.JUnitTestingUtils.*;
/**
* Verifies proper handling of the following in conjunction with the
- * {@link SpringJUnit4ClassRunner}:
+ * {@link SpringRunner}:
*
* - JUnit's {@link Test#timeout() @Test(timeout=...)}
* - Spring's {@link Timed @Timed}
@@ -49,7 +49,7 @@ public class TimedSpringRunnerTests {
}
protected Class extends Runner> getRunnerClass() {
- return SpringJUnit4ClassRunner.class;
+ return SpringRunner.class;
}
@Test
diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java
index 3fcdb040f2c..cffe292f168 100644
--- a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 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.
@@ -36,7 +36,7 @@ import static org.springframework.test.transaction.TransactionTestUtils.*;
* @author Sam Brannen
* @since 2.5
*/
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@ContextConfiguration("transactionalTests-context.xml")
@Transactional
public class TimedTransactionalSpringRunnerTests {
diff --git a/src/asciidoc/testing.adoc b/src/asciidoc/testing.adoc
index d6007bb6e91..1a61118f168 100644
--- a/src/asciidoc/testing.adoc
+++ b/src/asciidoc/testing.adoc
@@ -993,9 +993,8 @@ instead of `@PostConstruct` and `@PreDestroy`.
[[integration-testing-annotations-junit]]
==== Spring JUnit Testing Annotations
The following annotations are __only__ supported when used in conjunction with the
-<>,
-<>, or
-<>.
+<>, <>, or <>.
* `@IfProfileValue`
@@ -1159,13 +1158,13 @@ across our JUnit-based test suite...
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration({"/app-config.xml", "/test-data-access-config.xml"})
@ActiveProfiles("dev")
@Transactional
public class OrderRepositoryTests { }
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration({"/app-config.xml", "/test-data-access-config.xml"})
@ActiveProfiles("dev")
@Transactional
@@ -1192,11 +1191,11 @@ configuration of individual test classes as follows:
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@TransactionalDevTest
public class OrderRepositoryTests { }
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@TransactionalDevTest
public class UserRepositoryTests { }
----
@@ -1453,7 +1452,7 @@ on either a field or setter method. For example:
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration
public class MyTest {
@@ -1470,7 +1469,7 @@ the web application context into your test as follows:
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
**@WebAppConfiguration**
@ContextConfiguration
public class MyWebAppTest {
@@ -1515,7 +1514,7 @@ prefixed with `classpath:`, `file:`, `http:`, etc.) will be used __as is__.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from "/app-config.xml" and
// "/test-config.xml" in the root of the classpath
**@ContextConfiguration(locations={"/app-config.xml", "/test-config.xml"})**
@@ -1533,7 +1532,7 @@ demonstrated in the following example.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
**@ContextConfiguration({"/app-config.xml", "/test-config.xml"})**
public class MyTest {
// class body...
@@ -1552,7 +1551,7 @@ a default location based on the name of the test class. If your class is named
----
package com.example;
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from
// "classpath:com/example/MyTest-context.xml"
**@ContextConfiguration**
@@ -1582,7 +1581,7 @@ TestContext Framework is enabled automatically if Groovy is on the classpath.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from "/AppConfig.groovy" and
// "/TestConfig.groovy" in the root of the classpath
**@ContextConfiguration({"/AppConfig.groovy", "/TestConfig.Groovy"})**
@@ -1603,7 +1602,7 @@ detect a default location based on the name of the test class. If your class is
----
package com.example;
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from
// "classpath:com/example/MyTestContext.groovy"
**@ContextConfiguration**
@@ -1625,7 +1624,7 @@ The following listing demonstrates how to combine both in an integration test.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from
// "/app-config.xml" and "/TestConfig.groovy"
@ContextConfiguration({ "/app-config.xml", "/TestConfig.groovy" })
@@ -1645,7 +1644,7 @@ To load an `ApplicationContext` for your tests using __annotated classes__ (see
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from AppConfig and TestConfig
**@ContextConfiguration(classes = {AppConfig.class, TestConfig.class})**
public class MyTest {
@@ -1682,7 +1681,7 @@ configuration class is arbitrary. In addition, a test class can contain more tha
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from the
// static nested Config class
**@ContextConfiguration**
@@ -1761,7 +1760,7 @@ standard `@Priority` annotation.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from TestConfig
// and initialized by TestAppCtxInitializer
**@ContextConfiguration(
@@ -1781,7 +1780,7 @@ files or configuration classes.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be initialized by EntireAppInitializer
// which presumably registers beans in the context
**@ContextConfiguration(initializers = EntireAppInitializer.class)**
@@ -1816,7 +1815,7 @@ therefore __override__ (i.e., replace) those defined in __"base-config.xml"__.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from "/base-config.xml"
// in the root of the classpath
**@ContextConfiguration("/base-config.xml")**
@@ -1840,7 +1839,7 @@ override (i.e., replace) those defined in `BaseConfig`.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from BaseConfig
**@ContextConfiguration(classes = BaseConfig.class)**
public class BaseTest {
@@ -1863,7 +1862,7 @@ with Spring's `@Order` or the standard `@Priority` annotation.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be initialized by BaseInitializer
**@ContextConfiguration(initializers = BaseInitializer.class)**
public class BaseTest {
@@ -1948,7 +1947,7 @@ Let's take a look at some examples with XML configuration and `@Configuration` c
----
package com.bank.service;
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// ApplicationContext will be loaded from "classpath:/app-config.xml"
@ContextConfiguration("/app-config.xml")
@ActiveProfiles("dev")
@@ -2067,7 +2066,7 @@ integration test but using `@Configuration` classes instead of XML.
----
package com.bank.service;
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration(classes = {
TransferServiceConfig.class,
StandaloneDataConfig.class,
@@ -2115,7 +2114,7 @@ annotations) has been moved to an abstract superclass, `AbstractIntegrationTest`
----
package com.bank.service;
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration(classes = {
TransferServiceConfig.class,
StandaloneDataConfig.class,
@@ -2406,7 +2405,7 @@ a `WebApplicationContext`.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// defaults to "file:src/main/webapp"
@WebAppConfiguration
@@ -2433,7 +2432,7 @@ nested `@Configuration` classes).
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// file system resource
@WebAppConfiguration("webapp")
@@ -2456,7 +2455,7 @@ whereas, `@ContextConfiguration` resource locations are classpath based.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// classpath resource
@WebAppConfiguration("classpath:test-web-resources")
@@ -2637,7 +2636,7 @@ lowest context in the hierarchy).
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@WebAppConfiguration
@ContextHierarchy({
@ContextConfiguration(classes = TestAppConfig.class),
@@ -2672,7 +2671,7 @@ for the concrete subclasses.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@WebAppConfiguration
@ContextConfiguration("file:src/main/webapp/WEB-INF/applicationContext.xml")
public abstract class AbstractWebTests {}
@@ -2703,7 +2702,7 @@ and `{"/user-config.xml", "/order-config.xml"}`.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextHierarchy({
@ContextConfiguration(name = "parent", locations = "/app-config.xml"),
@ContextConfiguration(name = "child", locations = "/user-config.xml")
@@ -2729,7 +2728,7 @@ application context for `ExtendedTests` will be loaded only from
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextHierarchy({
@ContextConfiguration(name = "parent", locations = "/app-config.xml"),
@ContextConfiguration(name = "child", locations = "/user-config.xml")
@@ -2811,7 +2810,7 @@ The first code listing shows a JUnit-based implementation of the test class that
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// specifies the Spring configuration to load for this test fixture
**@ContextConfiguration("repository-config.xml")**
public class HibernateTitleRepositoryTests {
@@ -2834,7 +2833,7 @@ seen below.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
// specifies the Spring configuration to load for this test fixture
**@ContextConfiguration("repository-config.xml")**
public class HibernateTitleRepositoryTests {
@@ -2967,7 +2966,7 @@ inputs for the username and password.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration
@WebAppConfiguration
public class RequestScopedBeanTests {
@@ -3027,7 +3026,7 @@ configured theme.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration
@WebAppConfiguration
public class SessionScopedBeanTests {
@@ -3098,7 +3097,7 @@ See <> for an additional example.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration(classes = TestConfig.class)
@Transactional
public class HibernateUserRepositoryTests {
@@ -3238,7 +3237,7 @@ declarative SQL script execution with default transaction rollback semantics.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration
**@Transactional(transactionManager = "txMgr")**
**@Commit**
@@ -3434,7 +3433,7 @@ level within a JUnit-based integration test class.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration
@Sql("/test-schema.sql")
public class DatabaseTests {
@@ -3585,7 +3584,7 @@ be automatically rolled back by the `TransactionalTestExecutionListener` (see
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@ContextConfiguration(classes = TestDatabaseConfig.class)
@Transactional
public class TransactionalSqlScriptsTests {
@@ -3625,13 +3624,14 @@ be automatically rolled back by the `TransactionalTestExecutionListener` (see
The __Spring TestContext Framework__ offers full integration with JUnit 4 through a
custom runner (supported on JUnit 4.12 or higher). By annotating test classes with
-`@RunWith(SpringJUnit4ClassRunner.class)`, developers can implement standard JUnit-based
-unit and integration tests and simultaneously reap the benefits of the TestContext
-framework such as support for loading application contexts, dependency injection of test
-instances, transactional test method execution, and so on. If you would like to use the
-Spring TestContext Framework with an alternative runner such as JUnit's `Parameterized`
-or third-party runners such as the `MockitoJUnitRunner`, you may optionally use
-<> instead.
+`@RunWith(SpringJUnit4ClassRunner.class)` or the shorter `@RunWith(SpringRunner.class)`
+variant, developers can implement standard JUnit-based unit and integration tests and
+simultaneously reap the benefits of the TestContext framework such as support for loading
+application contexts, dependency injection of test instances, transactional test method
+execution, and so on. If you would like to use the Spring TestContext Framework with an
+alternative runner such as JUnit's `Parameterized` or third-party runners such as the
+`MockitoJUnitRunner`, you may optionally use <> instead.
The following code listing displays the minimal requirements for configuring a test class
to run with the custom Spring `Runner`. `@TestExecutionListeners` is configured with an
@@ -3641,7 +3641,7 @@ empty list in order to disable the default listeners, which otherwise would requ
[source,java,indent=0]
[subs="verbatim,quotes"]
----
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(SpringRunner.class)
@TestExecutionListeners({})
public class SimpleTest {
@@ -3666,10 +3666,10 @@ The `org.springframework.test.context.junit4.rules` package provides the followi
_Spring TestContext Framework_; whereas, `SpringMethodRule` is a JUnit `MethodRule` that
supports instance-level and method-level features of the _Spring TestContext Framework_.
-In contrast to the `SpringJUnit4ClassRunner`, Spring's rule-based JUnit support has the
-advantage that it is independent of any `org.junit.runner.Runner` implementation and can
-therefore be combined with existing alternative runners like JUnit's `Parameterized` or
-third-party runners such as the `MockitoJUnitRunner`.
+In contrast to the `SpringRunner`, Spring's rule-based JUnit support has the advantage
+that it is independent of any `org.junit.runner.Runner` implementation and can therefore
+be combined with existing alternative runners like JUnit's `Parameterized` or third-party
+runners such as the `MockitoJUnitRunner`.
In order to support the full functionality of the TestContext framework, a
`SpringClassRule` must be combined with a `SpringMethodRule`. The following example
@@ -3732,7 +3732,7 @@ provides an `executeSqlScript(..)` method for executing SQL scripts against the
====
These classes are a convenience for extension. If you do not want your test classes to be
tied to a Spring-specific class hierarchy, you can configure your own custom test classes
-by using `@RunWith(SpringJUnit4ClassRunner.class)` or <>.
====
@@ -3832,7 +3832,7 @@ JUnit-based example of using Spring MVC Test:
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@WebAppConfiguration
@ContextConfiguration("test-servlet-context.xml")
public class ExampleTests {
@@ -3892,7 +3892,7 @@ into the test to use to build a `MockMvc` instance:
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@WebAppConfiguration
@ContextConfiguration("my-servlet-context.xml")
public class MyWebTests {
@@ -3957,7 +3957,7 @@ expectations:
[source,java,indent=0]
[subs="verbatim,quotes"]
----
- @RunWith(SpringJUnit4ClassRunner.class)
+ @RunWith(SpringRunner.class)
@WebAppConfiguration
@ContextConfiguration("test-servlet-context.xml")
public class AccountTests {
diff --git a/src/asciidoc/whats-new.adoc b/src/asciidoc/whats-new.adoc
index 79069b5b955..a7adee3a0bb 100644
--- a/src/asciidoc/whats-new.adoc
+++ b/src/asciidoc/whats-new.adoc
@@ -676,8 +676,9 @@ Spring 4.3 also improves the caching abstraction as follows:
=== Testing Improvements
* The JUnit support in the _Spring TestContext Framework_ now requires JUnit 4.12 or higher.
+* New `SpringRunner` __alias__ for the `SpringJUnit4ClassRunner`.
* Server-side Spring MVC Test supports expectations on response headers with multiple values.
* Server-side Spring MVC Test parses form data request content and populates request parameters.
* Client-side REST test support allows indicating how many times a request is expected and
-whether the oder of declaration for expectations should be ignored (see <>)
+ whether the order of declaration for expectations should be ignored (see <>).
* Client-side REST Test supports expectations for form data in the request body.