From 2685818e9130942684bba1afa37cab8b96df74f3 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 28 Apr 2013 17:25:46 +0200 Subject: [PATCH] Delete deprecated code in the TestContext framework This commit deletes the deprecated @ExpectedException and @NotTransactional annotations, supporting code, and related Javadoc and reference documentation. Issue: SPR-10499 --- .../test/annotation/ExpectedException.java | 43 ------------- .../test/annotation/NotTransactional.java | 43 ------------- .../junit4/SpringJUnit4ClassRunner.java | 23 +------ .../TransactionalTestExecutionListener.java | 29 ++++----- ...bstractTransactionalSpringRunnerTests.java | 7 +-- ...ssLevelTransactionalSpringRunnerTests.java | 9 ++- ...TransactionalJUnit4SpringContextTests.java | 17 ++--- .../ExpectedExceptionSpringRunnerTests.java | 24 ++----- .../TimedTransactionalSpringRunnerTests.java | 14 ++--- ...TransactionalTestNGSpringContextTests.java | 5 +- ...TransactionalTestNGSpringContextTests.java | 17 ++--- src/reference/docbook/testing.xml | 63 +------------------ 12 files changed, 55 insertions(+), 239 deletions(-) delete mode 100644 spring-test/src/main/java/org/springframework/test/annotation/ExpectedException.java delete mode 100644 spring-test/src/main/java/org/springframework/test/annotation/NotTransactional.java diff --git a/spring-test/src/main/java/org/springframework/test/annotation/ExpectedException.java b/spring-test/src/main/java/org/springframework/test/annotation/ExpectedException.java deleted file mode 100644 index 944f3aeaead..00000000000 --- a/spring-test/src/main/java/org/springframework/test/annotation/ExpectedException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002-2012 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.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Test annotation to indicate that a test method is required to throw the - * specified exception. - * - * @author Rod Johnson - * @author Sam Brannen - * @since 2.0 - * @deprecated as of Spring 3.1 in favor of using built-in support for declaring - * expected exceptions in the underlying testing framework (e.g., JUnit, TestNG, etc.) - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Deprecated -public @interface ExpectedException { - - Class value(); - -} diff --git a/spring-test/src/main/java/org/springframework/test/annotation/NotTransactional.java b/spring-test/src/main/java/org/springframework/test/annotation/NotTransactional.java deleted file mode 100644 index c8539186644..00000000000 --- a/spring-test/src/main/java/org/springframework/test/annotation/NotTransactional.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002-2012 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.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Test annotation to indicate that a method is not transactional. - * - * @author Rod Johnson - * @author Sam Brannen - * @since 2.0 - * @deprecated as of Spring 3.0, in favor of moving the non-transactional test - * method to a separate (non-transactional) test class or to a - * {@link org.springframework.test.context.transaction.BeforeTransaction - * @BeforeTransaction} or - * {@link org.springframework.test.context.transaction.AfterTransaction - * @AfterTransaction} method. - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Deprecated -public @interface NotTransactional { -} 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 5496b4ee633..cb40a3273da 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-2012 the original author or authors. + * 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. @@ -34,7 +34,6 @@ import org.junit.runners.BlockJUnit4ClassRunner; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.InitializationError; import org.junit.runners.model.Statement; -import org.springframework.test.annotation.ExpectedException; import org.springframework.test.annotation.ProfileValueUtils; import org.springframework.test.annotation.Repeat; import org.springframework.test.annotation.Timed; @@ -64,7 +63,6 @@ import org.springframework.util.ReflectionUtils; *

*