Introduce SpringRunner 'alias' for SpringJUnit4ClassRunner
This commit introduces a SpringRunner extension of
SpringJUnit4ClassRunner that is intended to be used as an 'alias' for
SpringJUnit4ClassRunner, primarily in order to simplify configuration
of JUnit 4 based integration tests.
Developers can use this alias as follows:
@RunWith(SpringRunner.class)
public class MySpringIntegrationTests { ... }
Issue: SPR-13954
This commit is contained in:
@@ -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.
|
||||
@@ -61,10 +61,10 @@ import org.springframework.test.context.web.ServletTestExecutionListener;
|
||||
* <ul>
|
||||
* <li>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.</li>
|
||||
* <li>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 RunWith @RunWith(...)}.</li>
|
||||
@@ -85,7 +85,7 @@ import org.springframework.test.context.web.ServletTestExecutionListener;
|
||||
* @see AbstractTransactionalJUnit4SpringContextTests
|
||||
* @see org.springframework.test.context.testng.AbstractTestNGSpringContextTests
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
@TestExecutionListeners({ ServletTestExecutionListener.class, DirtiesContextBeforeModesTestExecutionListener.class,
|
||||
DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class })
|
||||
public abstract class AbstractJUnit4SpringContextTests implements ApplicationContextAware {
|
||||
|
||||
@@ -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.
|
||||
@@ -64,10 +64,10 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* <ul>
|
||||
* <li>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.</li>
|
||||
* <li>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(...)}.</li>
|
||||
|
||||
@@ -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;
|
||||
* <em>Spring TestContext Framework</em> to standard JUnit tests by means of the
|
||||
* {@link TestContextManager} and associated support classes and annotations.
|
||||
*
|
||||
* <p>To use this class, simply annotate a JUnit 4 based test class with
|
||||
* {@code @RunWith(SpringJUnit4ClassRunner.class)} or {@code @RunWith(SpringRunner.class)}.
|
||||
*
|
||||
* <p>The following list constitutes all annotations currently supported directly
|
||||
* or indirectly by {@code SpringJUnit4ClassRunner}. <em>(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
|
||||
|
||||
@@ -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 <em>alias</em> for the {@link SpringJUnit4ClassRunner}.
|
||||
*
|
||||
* <p>To use this class, simply annotate a JUnit 4 based test class with
|
||||
* {@code @RunWith(SpringRunner.class)}.
|
||||
*
|
||||
* <p>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}.
|
||||
*
|
||||
* <p><strong>NOTE:</strong> 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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}:
|
||||
*
|
||||
* <ul>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 <em>implicit, default {@link ProfileValueSource}</em>) annotations in
|
||||
* conjunction with the {@link SpringJUnit4ClassRunner}.
|
||||
* conjunction with the {@link SpringRunner}.
|
||||
* <p>
|
||||
* 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 {
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
* <em>explicit, custom defined {@link ProfileValueSource}</em>) annotations in
|
||||
* conjunction with the {@link SpringJUnit4ClassRunner}.
|
||||
* conjunction with the {@link SpringRunner}.
|
||||
* </p>
|
||||
*
|
||||
* @author Sam Brannen
|
||||
|
||||
@@ -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}:
|
||||
*
|
||||
* <ul>
|
||||
|
||||
@@ -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.*;
|
||||
/**
|
||||
* <p>
|
||||
* 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 {
|
||||
|
||||
|
||||
@@ -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}:
|
||||
* <ul>
|
||||
* <li>Spring's {@link Repeat @Repeat}</li>
|
||||
* <li>Spring's {@link Timed @Timed}</li>
|
||||
@@ -82,7 +82,7 @@ public class RepeatedSpringRunnerTests {
|
||||
}
|
||||
|
||||
protected Class<? extends Runner> getRunnerClass() {
|
||||
return SpringJUnit4ClassRunner.class;
|
||||
return SpringRunner.class;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 <em>proof of concept</em>
|
||||
* 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:
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@link ContextConfiguration @ContextConfiguration}</li>
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
* <em>Spring TestContext Framework</em>; only intended to be run manually as a
|
||||
* convenience.
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
* <p>Note that tests included in this suite will be executed at least twice if
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 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.
|
||||
* </p>
|
||||
* <p>
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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}:
|
||||
* <ul>
|
||||
* <li>JUnit's {@link Test#timeout() @Test(timeout=...)}</li>
|
||||
* <li>Spring's {@link Timed @Timed}</li>
|
||||
@@ -49,7 +49,7 @@ public class TimedSpringRunnerTests {
|
||||
}
|
||||
|
||||
protected Class<? extends Runner> getRunnerClass() {
|
||||
return SpringJUnit4ClassRunner.class;
|
||||
return SpringRunner.class;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user