[SPR-8030] AbstractJUnit38SpringContextTests and AbstractTransactionalJUnit38SpringContextTests are now officially deprecated.

This commit is contained in:
Sam Brannen
2011-03-28 14:43:01 +00:00
parent a3a0e5165c
commit 657b145ea2
3 changed files with 17 additions and 16 deletions

View File

@@ -28,7 +28,6 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.Parameters;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestContext; import org.springframework.test.context.TestContext;
import org.springframework.test.context.TestExecutionListener; import org.springframework.test.context.TestExecutionListener;
@@ -47,7 +46,7 @@ import org.springframework.test.context.transaction.BeforeTransaction;
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3960" * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3960"
* target="_blank">SPR-3960</a>. * target="_blank">SPR-3960</a>.
* </p> * </p>
* *
* @author Sam Brannen * @author Sam Brannen
* @since 2.5 * @since 2.5
*/ */
@@ -83,9 +82,9 @@ public class FailingBeforeAndAfterMethodsTests {
testCase.setName(testName); testCase.setName(testName);
TestResult testResult = testCase.run(); TestResult testResult = testCase.run();
assertEquals("Verifying number of errors for test method [" + testName + "] and class [" + this.clazz + "].", assertEquals("Verifying number of errors for test method [" + testName + "] and class [" + this.clazz + "].",
0, testResult.errorCount()); 0, testResult.errorCount());
assertEquals("Verifying number of failures for test method [" + testName + "] and class [" + this.clazz + "].", assertEquals("Verifying number of failures for test method [" + testName + "] and class [" + this.clazz + "].",
1, testResult.failureCount()); 1, testResult.failureCount());
} }
@@ -97,7 +96,6 @@ public class FailingBeforeAndAfterMethodsTests {
} }
} }
static class AlwaysFailingAfterTestMethodTestExecutionListener extends AbstractTestExecutionListener { static class AlwaysFailingAfterTestMethodTestExecutionListener extends AbstractTestExecutionListener {
@Override @Override
@@ -106,24 +104,24 @@ public class FailingBeforeAndAfterMethodsTests {
} }
} }
@SuppressWarnings("deprecation")
@TestExecutionListeners(value = { AlwaysFailingBeforeTestMethodTestExecutionListener.class }, inheritListeners = false) @TestExecutionListeners(listeners = AlwaysFailingBeforeTestMethodTestExecutionListener.class, inheritListeners = false)
public static class AlwaysFailingBeforeTestMethodTestCase extends AbstractJUnit38SpringContextTests { public static class AlwaysFailingBeforeTestMethodTestCase extends AbstractJUnit38SpringContextTests {
public void testNothing() { public void testNothing() {
} }
} }
@SuppressWarnings("deprecation")
@TestExecutionListeners(value = { AlwaysFailingAfterTestMethodTestExecutionListener.class }, inheritListeners = false) @TestExecutionListeners(listeners = AlwaysFailingAfterTestMethodTestExecutionListener.class, inheritListeners = false)
public static class AlwaysFailingAfterTestMethodTestCase extends AbstractJUnit38SpringContextTests { public static class AlwaysFailingAfterTestMethodTestCase extends AbstractJUnit38SpringContextTests {
public void testNothing() { public void testNothing() {
} }
} }
@SuppressWarnings("deprecation")
@ContextConfiguration(locations = { "FailingBeforeAndAfterMethodsTests-context.xml" }) @ContextConfiguration("FailingBeforeAndAfterMethodsTests-context.xml")
public static class FailingBeforeTransactionalTestCase extends AbstractTransactionalJUnit38SpringContextTests { public static class FailingBeforeTransactionalTestCase extends AbstractTransactionalJUnit38SpringContextTests {
public void testNothing() { public void testNothing() {
@@ -135,7 +133,8 @@ public class FailingBeforeAndAfterMethodsTests {
} }
} }
@ContextConfiguration(locations = { "FailingBeforeAndAfterMethodsTests-context.xml" }) @SuppressWarnings("deprecation")
@ContextConfiguration("FailingBeforeAndAfterMethodsTests-context.xml")
public static class FailingAfterTransactionalTestCase extends AbstractTransactionalJUnit38SpringContextTests { public static class FailingAfterTransactionalTestCase extends AbstractTransactionalJUnit38SpringContextTests {
public void testNothing() { public void testNothing() {

View File

@@ -137,7 +137,8 @@ public class ProfileValueJUnit38SpringContextTests extends TestCase {
* explicitly configured with an empty list, thus disabling all default * explicitly configured with an empty list, thus disabling all default
* listeners. * listeners.
*/ */
@TestExecutionListeners(value = {}, inheritListeners = false) @SuppressWarnings("deprecation")
@TestExecutionListeners(listeners = {}, inheritListeners = false)
public static class DefaultProfileValueSourceTestCase extends AbstractJUnit38SpringContextTests { public static class DefaultProfileValueSourceTestCase extends AbstractJUnit38SpringContextTests {
int invocationCount = 0; int invocationCount = 0;

View File

@@ -24,7 +24,7 @@ import org.springframework.test.context.TestExecutionListeners;
/** /**
* Unit test for {@link AbstractJUnit38SpringContextTests} which focuses on * Unit test for {@link AbstractJUnit38SpringContextTests} which focuses on
* proper support of the {@link Repeat @Repeat} annotation. * proper support of the {@link Repeat @Repeat} annotation.
* *
* @author Sam Brannen * @author Sam Brannen
* @since 2.5 * @since 2.5
*/ */
@@ -42,7 +42,7 @@ public class RepeatedJUnit38SpringContextTests extends TestCase {
final RepeatedTestCase repeatedTestCase = new RepeatedTestCase(testName); final RepeatedTestCase repeatedTestCase = new RepeatedTestCase(testName);
repeatedTestCase.run(); repeatedTestCase.run();
assertEquals("Verifying number of invocations for test method [" + testName + "].", expectedNumInvocations, assertEquals("Verifying number of invocations for test method [" + testName + "].", expectedNumInvocations,
repeatedTestCase.invocationCount); repeatedTestCase.invocationCount);
} }
public void testRepeatAnnotationSupport() throws Exception { public void testRepeatAnnotationSupport() throws Exception {
@@ -58,7 +58,8 @@ public class RepeatedJUnit38SpringContextTests extends TestCase {
* explicitly configured with an empty list, thus disabling all default * explicitly configured with an empty list, thus disabling all default
* listeners. * listeners.
*/ */
@TestExecutionListeners(value = {}, inheritListeners = false) @SuppressWarnings("deprecation")
@TestExecutionListeners(listeners = {}, inheritListeners = false)
protected static class RepeatedTestCase extends AbstractJUnit38SpringContextTests { protected static class RepeatedTestCase extends AbstractJUnit38SpringContextTests {
int invocationCount = 0; int invocationCount = 0;