diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit4.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit4.adoc index fdc6470f968..f7e41bb4f64 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit4.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit4.adoc @@ -1,6 +1,13 @@ [[integration-testing-annotations-junit4]] = Spring JUnit 4 Testing Annotations +[WARNING] +==== +JUnit 4 support is deprecated since Spring Framework 7.0 in favor of the +xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`] +and JUnit Jupiter. +==== + The following annotations are supported only when used in conjunction with the xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit4-runner[SpringRunner], xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit4-rules[Spring's JUnit 4 rules], or @@ -206,6 +213,3 @@ Kotlin:: ---- <1> Repeat this test ten times. ====== - - - diff --git a/framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc b/framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc index a7798005873..9fdad623a96 100644 --- a/framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc +++ b/framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc @@ -483,6 +483,13 @@ Kotlin:: [[testcontext-junit4-runner]] === Spring JUnit 4 Runner +[WARNING] +==== +JUnit 4 support is deprecated since Spring Framework 7.0 in favor of the +xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`] +and JUnit Jupiter. +==== + 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)` or the shorter `@RunWith(SpringRunner.class)` @@ -538,6 +545,13 @@ be configured through `@ContextConfiguration`. [[testcontext-junit4-rules]] === Spring JUnit 4 Rules +[WARNING] +==== +JUnit 4 support is deprecated since Spring Framework 7.0 in favor of the +xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`] +and JUnit Jupiter. +==== + The `org.springframework.test.context.junit4.rules` package provides the following JUnit 4 rules (supported on JUnit 4.12 or higher): @@ -607,6 +621,13 @@ Kotlin:: [[testcontext-support-classes-junit4]] === JUnit 4 Base Classes +[WARNING] +==== +JUnit 4 support is deprecated since Spring Framework 7.0 in favor of the +xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`] +for JUnit Jupiter. +==== + The `org.springframework.test.context.junit4` package provides the following support classes for JUnit 4-based test cases (supported on JUnit 4.12 or higher): diff --git a/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java b/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java index 9af1ec7492e..96689bb0f2f 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -94,11 +94,15 @@ import java.lang.annotation.Target; * @see org.springframework.test.context.junit4.statements.ProfileValueChecker * @see org.springframework.context.annotation.Profile * @see org.springframework.test.context.ActiveProfiles + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited +@Deprecated(since = "7.0") public @interface IfProfileValue { /** diff --git a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSource.java b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSource.java index 4121bcfeae5..33551d5f442 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSource.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.jspecify.annotations.Nullable; * @see ProfileValueSourceConfiguration * @see IfProfileValue * @see ProfileValueUtils + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public interface ProfileValueSource { /** diff --git a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java index 37af23cb3d2..667f5f8dd13 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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,11 +37,15 @@ import java.lang.annotation.Target; * @see ProfileValueSource * @see IfProfileValue * @see ProfileValueUtils + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited +@Deprecated(since = "7.0") public @interface ProfileValueSourceConfiguration { /** diff --git a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java index ed2e5e08ad1..472f65259bf 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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,9 @@ import org.springframework.util.StringUtils; * @see ProfileValueSource * @see ProfileValueSourceConfiguration * @see IfProfileValue + * @deprecated since Spring Framework 7.0 with no replacement */ +@Deprecated(since = "7.0") public abstract class ProfileValueUtils { private static final Log logger = LogFactory.getLog(ProfileValueUtils.class); diff --git a/spring-test/src/main/java/org/springframework/test/annotation/Repeat.java b/spring-test/src/main/java/org/springframework/test/annotation/Repeat.java index dfa062ceb2b..7ff46c35a72 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/Repeat.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/Repeat.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2025 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. @@ -44,10 +44,14 @@ import java.lang.annotation.Target; * @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner * @see org.springframework.test.context.junit4.rules.SpringMethodRule * @see org.springframework.test.context.junit4.statements.SpringRepeat + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented +@Deprecated(since = "7.0") public @interface Repeat { /** diff --git a/spring-test/src/main/java/org/springframework/test/annotation/SystemProfileValueSource.java b/spring-test/src/main/java/org/springframework/test/annotation/SystemProfileValueSource.java index 4a0f627664a..b021904b6c1 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/SystemProfileValueSource.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/SystemProfileValueSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -25,7 +25,11 @@ import org.springframework.util.Assert; * @author Rod Johnson * @author Sam Brannen * @since 2.0 + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public final class SystemProfileValueSource implements ProfileValueSource { private static final SystemProfileValueSource INSTANCE = new SystemProfileValueSource(); diff --git a/spring-test/src/main/java/org/springframework/test/annotation/TestAnnotationUtils.java b/spring-test/src/main/java/org/springframework/test/annotation/TestAnnotationUtils.java index e0b4ac927a9..c61fb8e8cf4 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/TestAnnotationUtils.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/TestAnnotationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2025 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. @@ -25,7 +25,10 @@ import org.springframework.core.annotation.AnnotatedElementUtils; * * @author Sam Brannen * @since 4.2 + * @see org.springframework.test.context.TestContextAnnotationUtils + * @deprecated since Spring Framework 7.0 with no replacement */ +@Deprecated(since = "7.0") public abstract class TestAnnotationUtils { /** diff --git a/spring-test/src/main/java/org/springframework/test/annotation/Timed.java b/spring-test/src/main/java/org/springframework/test/annotation/Timed.java index 3e5ca273ebc..b40597c076b 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/Timed.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/Timed.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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,10 +43,14 @@ import java.lang.annotation.Target; * @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner * @see org.springframework.test.context.junit4.rules.SpringMethodRule * @see org.springframework.test.context.junit4.statements.SpringFailOnTimeout + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented +@Deprecated(since = "7.0") public @interface Timed { /** diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java index 05e1861d01c..a873d57e335 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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. @@ -62,8 +62,12 @@ import org.springframework.test.context.TestExecutionListeners; * @see TestExecutionListeners * @see AbstractTransactionalJUnit4SpringContextTests * @see org.springframework.test.context.testng.AbstractTestNGSpringContextTests + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ @RunWith(SpringRunner.class) +@Deprecated(since = "7.0") public abstract class AbstractJUnit4SpringContextTests implements ApplicationContextAware { /** diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java index c8970a91513..6d1e5a688d9 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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. @@ -78,8 +78,12 @@ import org.springframework.util.Assert; * @see org.springframework.test.context.transaction.AfterTransaction * @see org.springframework.test.jdbc.JdbcTestUtils * @see org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ @Transactional +@Deprecated(since = "7.0") public abstract class AbstractTransactionalJUnit4SpringContextTests extends AbstractJUnit4SpringContextTests { /** 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 e98b57e6653..c8bb57dd6d8 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-2023 the original author or authors. + * Copyright 2002-2025 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. @@ -93,7 +93,11 @@ import org.springframework.util.ReflectionUtils; * @see AbstractTransactionalJUnit4SpringContextTests * @see org.springframework.test.context.junit4.rules.SpringClassRule * @see org.springframework.test.context.junit4.rules.SpringMethodRule + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner { private static final Log logger = LogFactory.getLog(SpringJUnit4ClassRunner.class); 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 index dd6ca659bc9..97bfd42b4a6 100644 --- 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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. @@ -35,7 +35,11 @@ import org.junit.runners.model.InitializationError; * @see SpringJUnit4ClassRunner * @see org.springframework.test.context.junit4.rules.SpringClassRule * @see org.springframework.test.context.junit4.rules.SpringMethodRule + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public final class SpringRunner extends SpringJUnit4ClassRunner { /** diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/rules/SpringClassRule.java b/spring-test/src/main/java/org/springframework/test/context/junit4/rules/SpringClassRule.java index f2c5f31dce9..d0da5972dfa 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/rules/SpringClassRule.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/rules/SpringClassRule.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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. @@ -81,7 +81,11 @@ import org.springframework.util.Assert; * @see SpringMethodRule * @see org.springframework.test.context.TestContextManager * @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class SpringClassRule implements TestRule { private static final Log logger = LogFactory.getLog(SpringClassRule.class); diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/rules/SpringMethodRule.java b/spring-test/src/main/java/org/springframework/test/context/junit4/rules/SpringMethodRule.java index bb205c7cd82..2ebacc0bc4a 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/rules/SpringMethodRule.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/rules/SpringMethodRule.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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. @@ -95,7 +95,11 @@ import org.springframework.test.context.junit4.statements.SpringRepeat; * @see SpringClassRule * @see org.springframework.test.context.TestContextManager * @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class SpringMethodRule implements MethodRule { private static final Log logger = LogFactory.getLog(SpringMethodRule.class); diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/ProfileValueChecker.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/ProfileValueChecker.java index 293dcd0eef8..7da5c29e8d1 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/ProfileValueChecker.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/ProfileValueChecker.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2025 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. @@ -39,7 +39,11 @@ import org.springframework.util.Assert; * @see #evaluate() * @see IfProfileValue * @see ProfileValueUtils + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class ProfileValueChecker extends Statement { private final Statement next; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestClassCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestClassCallbacks.java index 467b2f70816..c3961521906 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestClassCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestClassCallbacks.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.springframework.test.context.TestContextManager; * @since 3.0 * @see #evaluate() * @see RunBeforeTestClassCallbacks + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class RunAfterTestClassCallbacks extends Statement { private final Statement next; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestExecutionCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestExecutionCallbacks.java index f166cd26a06..8e4b67961d4 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestExecutionCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestExecutionCallbacks.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.springframework.test.context.TestContextManager; * @since 5.0 * @see #evaluate() * @see RunBeforeTestExecutionCallbacks + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class RunAfterTestExecutionCallbacks extends Statement { private final Statement next; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestMethodCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestMethodCallbacks.java index db8b747b97b..687c027d97c 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestMethodCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestMethodCallbacks.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.springframework.test.context.TestContextManager; * @since 3.0 * @see #evaluate() * @see RunBeforeTestMethodCallbacks + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class RunAfterTestMethodCallbacks extends Statement { private final Statement next; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestClassCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestClassCallbacks.java index afadf43a889..1979d2d9c9a 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestClassCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestClassCallbacks.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.springframework.test.context.TestContextManager; * @since 3.0 * @see #evaluate() * @see RunAfterTestMethodCallbacks + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class RunBeforeTestClassCallbacks extends Statement { private final Statement next; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestExecutionCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestExecutionCallbacks.java index f95eb5a3823..3f260a92e75 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestExecutionCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestExecutionCallbacks.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.springframework.test.context.TestContextManager; * @since 5.0 * @see #evaluate() * @see RunAfterTestExecutionCallbacks + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class RunBeforeTestExecutionCallbacks extends Statement { private final Statement next; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestMethodCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestMethodCallbacks.java index 7e5c882a258..08bd8f512e8 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestMethodCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestMethodCallbacks.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.springframework.test.context.TestContextManager; * @since 3.0 * @see #evaluate() * @see RunAfterTestMethodCallbacks + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class RunBeforeTestMethodCallbacks extends Statement { private final Statement next; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunPrepareTestInstanceCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunPrepareTestInstanceCallbacks.java index 12baf0ea777..d041ccfde98 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunPrepareTestInstanceCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunPrepareTestInstanceCallbacks.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.springframework.test.context.TestContextManager; * @author Sam Brannen * @since 4.2 * @see #evaluate() + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class RunPrepareTestInstanceCallbacks extends Statement { private final Statement next; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeout.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeout.java index cb4e1dc6d9c..88d70034c28 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeout.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeout.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.springframework.util.Assert; * @author Sam Brannen * @since 3.0 * @see #evaluate() + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class SpringFailOnTimeout extends Statement { private final Statement next; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringRepeat.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringRepeat.java index b7277f364de..9adce864626 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringRepeat.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringRepeat.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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,11 @@ import org.springframework.test.annotation.TestAnnotationUtils; * @author Sam Brannen * @since 3.0 * @see #evaluate() + * @deprecated since Spring Framework 7.0 in favor of the + * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} + * and JUnit Jupiter */ +@Deprecated(since = "7.0") public class SpringRepeat extends Statement { protected static final Log logger = LogFactory.getLog(SpringRepeat.class); diff --git a/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueUtilsTests.java b/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueUtilsTests.java index c5c82c39729..d3d8a564c50 100644 --- a/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueUtilsTests.java +++ b/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueUtilsTests.java @@ -31,6 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Sam Brannen * @since 3.0 */ +@SuppressWarnings("deprecation") class ProfileValueUtilsTests { private static final String NON_ANNOTATED_METHOD = "nonAnnotatedMethod"; @@ -140,7 +141,6 @@ class ProfileValueUtilsTests { @Test void isTestEnabledInThisEnvironmentForProvidedProfileValueSourceMethodAndClass() throws Exception { - ProfileValueSource profileValueSource = SystemProfileValueSource.getInstance(); assertMethodIsEnabled(profileValueSource, NON_ANNOTATED_METHOD, NonAnnotated.class); diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/samples/basic/BasicSpringVintageTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/samples/basic/BasicSpringVintageTests.java index 4e1189674b0..e9186c0961f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/aot/samples/basic/BasicSpringVintageTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/aot/samples/basic/BasicSpringVintageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2025 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. @@ -46,6 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; // Override the default loader configured by the CustomXmlBootstrapper @ContextConfiguration(classes = BasicTestConfiguration.class, loader = AnnotationConfigContextLoader.class) @TestPropertySource +@SuppressWarnings("deprecation") public class BasicSpringVintageTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/samples/web/WebSpringVintageTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/samples/web/WebSpringVintageTests.java index d18c2068388..14c3e1b9df7 100644 --- a/spring-test/src/test/java/org/springframework/test/context/aot/samples/web/WebSpringVintageTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/aot/samples/web/WebSpringVintageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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,6 +41,7 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppC @ContextConfiguration(classes = WebTestConfiguration.class) @WebAppConfiguration @TestPropertySource(properties = "test.engine = vintage") +@SuppressWarnings("deprecation") public class WebSpringVintageTests { MockMvc mockMvc; diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/samples/xml/XmlSpringVintageTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/samples/xml/XmlSpringVintageTests.java index 1e67f5dc320..0fe9cffbf6f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/aot/samples/xml/XmlSpringVintageTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/aot/samples/xml/XmlSpringVintageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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. @@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) @ContextConfiguration("test-config.xml") @TestPropertySource(properties = "test.engine = vintage") +@SuppressWarnings("deprecation") public class XmlSpringVintageTests { @Autowired 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 60938afcb5b..0a3a3cfa198 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-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.fail; @TestExecutionListeners(ClassLevelDisabledSpringRunnerTests.CustomTestExecutionListener.class) @IfProfileValue(name = "ClassLevelDisabledSpringRunnerTests.profile_value.name", value = "enigmaX") @DisabledInAotMode("@IfProfileValue is not supported for AOT processing") +@SuppressWarnings("deprecation") public class ClassLevelDisabledSpringRunnerTests { @Test diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java index d3091d721ef..9b861de02cd 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2025 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. @@ -44,6 +44,7 @@ import static org.springframework.transaction.support.TransactionSynchronization * @since 2.5 */ @ContextConfiguration +@SuppressWarnings("deprecation") public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTransactionalJUnit4SpringContextTests implements BeanNameAware, InitializingBean { 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 52cbface38d..79607846182 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-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -49,6 +49,7 @@ import static org.assertj.core.api.Assertions.fail; @RunWith(SpringRunner.class) @TestExecutionListeners({}) @DisabledInAotMode("Does not load an ApplicationContext and thus not supported for AOT processing") +@SuppressWarnings("deprecation") public class EnabledAndIgnoredSpringRunnerTests { protected static final String NAME = "EnabledAndIgnoredSpringRunnerTests.profile_value.name"; 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 d21f39275e1..cdca82c8b10 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-2019 the original author or authors. + * Copyright 2002-2025 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,13 +28,14 @@ import org.springframework.test.context.TestExecutionListeners; import static org.springframework.test.context.junit4.JUnitTestingUtils.runTestsAndAssertCounters; /** - * Verifies proper handling of JUnit's {@link Test#expected() @Test(expected = ...)} + * Verifies proper handling of JUnit's {@link Test#expected() @Test(expected = ...)} * support in conjunction with the {@link SpringRunner}. * * @author Sam Brannen * @since 3.0 */ @RunWith(JUnit4.class) +@SuppressWarnings("deprecation") public class ExpectedExceptionSpringRunnerTests { @Test diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsSpringRunnerTests.java index 2d0908c35c4..51aee6481e6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsSpringRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2025 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. @@ -50,6 +50,7 @@ import static org.springframework.test.context.junit4.JUnitTestingUtils.runTests * @since 2.5 */ @RunWith(Parameterized.class) +@SuppressWarnings("deprecation") public class FailingBeforeAndAfterMethodsSpringRunnerTests { protected final Class clazz; 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 7c5fec7dc6d..c6212676376 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-2024 the original author or authors. + * Copyright 2002-2025 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,6 +38,7 @@ import org.springframework.test.context.aot.DisabledInAotMode; */ @ProfileValueSourceConfiguration(HardCodedProfileValueSourceSpringRunnerTests.HardCodedProfileValueSource.class) @DisabledInAotMode("Because EnabledAndIgnoredSpringRunnerTests is disabled in AOT mode") +@SuppressWarnings("deprecation") public class HardCodedProfileValueSourceSpringRunnerTests extends EnabledAndIgnoredSpringRunnerTests { @BeforeClass 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 10308ff18ae..5e856dcb4e4 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-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -47,6 +47,7 @@ import static org.springframework.test.context.junit4.JUnitTestingUtils.runTests * @since 3.0 */ @RunWith(Parameterized.class) +@SuppressWarnings("deprecation") public class RepeatedSpringRunnerTests { protected static final AtomicInteger invocationCount = new AtomicInteger(); 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 92005176dc5..f523335765b 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-2023 the original author or authors. + * Copyright 2002-2025 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,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) @TestExecutionListeners({}) @DisabledInAotMode("Does not load an ApplicationContext and thus not supported for AOT processing") +@SuppressWarnings("deprecation") public class SpringJUnit47ClassRunnerRuleTests { @Rule @@ -53,4 +54,5 @@ public class SpringJUnit47ClassRunnerRuleTests { public void testB() { assertThat(name.getMethodName()).isEqualTo("testB"); } + } diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerTests.java index 6206af66493..5c336eda98a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThatException; * @author Rick Evans * @since 2.5 */ +@SuppressWarnings("deprecation") public class SpringJUnit4ClassRunnerTests { @Test 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 0535382b252..04a8c8a6165 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-2023 the original author or authors. + * Copyright 2002-2025 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,15 +22,12 @@ import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.aot.DisabledInAotMode; /** - *

- * Simple unit test to verify that {@link SpringRunner} does not - * hinder correct functionality of standard JUnit 4.4+ testing features. - *

- *

- * Note that {@link TestExecutionListeners @TestExecutionListeners} is + * Simple unit test to verify that the {@link SpringRunner} does not + * hinder correct functionality of standard JUnit 4 testing features. + * + *

Note that {@link TestExecutionListeners @TestExecutionListeners} is * explicitly configured with an empty list, thus disabling all default * listeners. - *

* * @author Sam Brannen * @since 2.5 @@ -39,6 +36,7 @@ import org.springframework.test.context.aot.DisabledInAotMode; @RunWith(SpringRunner.class) @TestExecutionListeners({}) @DisabledInAotMode("Does not load an ApplicationContext and thus not supported for AOT processing") +@SuppressWarnings("deprecation") public class StandardJUnit4FeaturesSpringRunnerTests extends StandardJUnit4FeaturesTests { /* All tests are in the parent class... */ 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 57618ea1258..a13bc8b8ae0 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-2022 the original author or authors. + * Copyright 2002-2025 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,6 +43,7 @@ import static org.springframework.test.context.junit4.JUnitTestingUtils.runTests * @since 3.0 */ @RunWith(JUnit4.class) +@SuppressWarnings("deprecation") public class TimedSpringRunnerTests { protected Class getTestCase() { 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 1262248c677..2cf572e1279 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-2019 the original author or authors. + * Copyright 2002-2025 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,6 +40,7 @@ import static org.springframework.test.transaction.TransactionAssert.assertThatT @RunWith(SpringRunner.class) @ContextConfiguration("/org/springframework/test/context/transaction/transactionalTests-context.xml") @Transactional +@SuppressWarnings("deprecation") public class TimedTransactionalSpringRunnerTests { @Test diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsAsyncIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsAsyncIntegrationTests.java index a416690acd6..1010d8f8516 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsAsyncIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsAsyncIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -44,6 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @RecordApplicationEvents +@SuppressWarnings("deprecation") public class JUnit4ApplicationEventsAsyncIntegrationTests { @Rule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsIntegrationTests.java index b5622f6487c..de7cd56ad94 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/event/JUnit4ApplicationEventsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2025 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,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @RecordApplicationEvents +@SuppressWarnings("deprecation") public class JUnit4ApplicationEventsIntegrationTests { @Rule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/nested/SpringRuleConfigurer.java b/spring-test/src/test/java/org/springframework/test/context/junit4/nested/SpringRuleConfigurer.java index 983a276f43d..2fc9a237372 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/nested/SpringRuleConfigurer.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/nested/SpringRuleConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2025 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,6 +29,7 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule; * @author Sam Brannen * @since 5.0 */ +@SuppressWarnings("deprecation") public abstract class SpringRuleConfigurer { @ClassRule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/AutowiredRuleSpr15927Tests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/AutowiredRuleSpr15927Tests.java index e4b26bfabd0..2185ce7a0df 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/AutowiredRuleSpr15927Tests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/AutowiredRuleSpr15927Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Sam Brannen * @since 5.0 */ +@SuppressWarnings("deprecation") public class AutowiredRuleSpr15927Tests { @ClassRule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BaseAppCtxRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BaseAppCtxRuleTests.java index 2c7fad66218..166c06b1e58 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BaseAppCtxRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BaseAppCtxRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2025 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,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @see Subclass2AppCtxRuleTests */ @ContextConfiguration +@SuppressWarnings("deprecation") public class BaseAppCtxRuleTests { @ClassRule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BasicAnnotationConfigWacSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BasicAnnotationConfigWacSpringRuleTests.java index 326e5f5621f..86931fc5dac 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BasicAnnotationConfigWacSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BasicAnnotationConfigWacSpringRuleTests.java @@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(JUnit4.class) @ContextConfiguration +@SuppressWarnings("deprecation") public class BasicAnnotationConfigWacSpringRuleTests extends AbstractBasicWacTests { @ClassRule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BeforeAndAfterTransactionAnnotationSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BeforeAndAfterTransactionAnnotationSpringRuleTests.java index 24f6acba7d8..c08286f5fc4 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BeforeAndAfterTransactionAnnotationSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/BeforeAndAfterTransactionAnnotationSpringRuleTests.java @@ -51,6 +51,7 @@ import static org.springframework.test.transaction.TransactionAssert.assertThatT @RunWith(JUnit4.class) @ContextConfiguration("/org/springframework/test/context/transaction/transactionalTests-context.xml") @Transactional +@SuppressWarnings("deprecation") public class BeforeAndAfterTransactionAnnotationSpringRuleTests { private static final String JANE = "jane"; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ClassLevelDisabledSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ClassLevelDisabledSpringRuleTests.java index 453a9c7ef2b..206d26c8b2b 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ClassLevelDisabledSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ClassLevelDisabledSpringRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2025 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,6 +32,7 @@ import org.springframework.test.context.junit4.ClassLevelDisabledSpringRunnerTes * @since 4.2 */ @RunWith(JUnit4.class) +@SuppressWarnings("deprecation") public class ClassLevelDisabledSpringRuleTests extends ClassLevelDisabledSpringRunnerTests { @ClassRule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/EnabledAndIgnoredSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/EnabledAndIgnoredSpringRuleTests.java index 27f29eca93d..3e032d6884a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/EnabledAndIgnoredSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/EnabledAndIgnoredSpringRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2025 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,6 +32,7 @@ import org.springframework.test.context.junit4.EnabledAndIgnoredSpringRunnerTest * @since 4.2 */ @RunWith(JUnit4.class) +@SuppressWarnings("deprecation") public class EnabledAndIgnoredSpringRuleTests extends EnabledAndIgnoredSpringRunnerTests { @ClassRule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/FailingBeforeAndAfterMethodsSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/FailingBeforeAndAfterMethodsSpringRuleTests.java index 06e57154990..00a9b319ba6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/FailingBeforeAndAfterMethodsSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/FailingBeforeAndAfterMethodsSpringRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2025 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. @@ -42,6 +42,7 @@ import static org.assertj.core.api.Assertions.fail; * @author Sam Brannen * @since 4.2 */ +@SuppressWarnings("deprecation") public class FailingBeforeAndAfterMethodsSpringRuleTests extends FailingBeforeAndAfterMethodsSpringRunnerTests { @Parameters(name = "{0}") diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/MockitoBeanAndSpringMethodRuleWithRepeatJUnit4IntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/MockitoBeanAndSpringMethodRuleWithRepeatJUnit4IntegrationTests.java index 15211ba521a..7c781630bf2 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/MockitoBeanAndSpringMethodRuleWithRepeatJUnit4IntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/MockitoBeanAndSpringMethodRuleWithRepeatJUnit4IntegrationTests.java @@ -35,6 +35,7 @@ import static org.mockito.Mockito.when; * @author Sam Brannen * @see gh-27693 */ +@SuppressWarnings("deprecation") public class MockitoBeanAndSpringMethodRuleWithRepeatJUnit4IntegrationTests { private static int invocations; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ParameterizedSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ParameterizedSpringRuleTests.java index 4c13272bb10..3758a9fe13b 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ParameterizedSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ParameterizedSpringRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2025 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. @@ -47,6 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(Parameterized.class) @ContextConfiguration("../ParameterizedDependencyInjectionTests-context.xml") +@SuppressWarnings("deprecation") public class ParameterizedSpringRuleTests { private static final AtomicInteger invocationCount = new AtomicInteger(); diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ProgrammaticTxMgmtSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ProgrammaticTxMgmtSpringRuleTests.java index 79ccf31fa71..a6b294c1dfa 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ProgrammaticTxMgmtSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/ProgrammaticTxMgmtSpringRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2025 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. @@ -65,6 +65,7 @@ import static org.springframework.test.transaction.TransactionAssert.assertThatT @RunWith(JUnit4.class) @ContextConfiguration @Transactional +@SuppressWarnings("deprecation") public class ProgrammaticTxMgmtSpringRuleTests { @ClassRule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/RepeatedSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/RepeatedSpringRuleTests.java index 5d3441b2076..0641b4c3093 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/RepeatedSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/RepeatedSpringRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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,6 +40,7 @@ import org.springframework.test.context.junit4.RepeatedSpringRunnerTests; * @author Sam Brannen * @since 4.2 */ +@SuppressWarnings("deprecation") public class RepeatedSpringRuleTests extends RepeatedSpringRunnerTests { @Parameters(name = "{0}") diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TimedSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TimedSpringRuleTests.java index 68b29e8d830..de14a6945bb 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TimedSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TimedSpringRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2025 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. @@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.fail; * @author Sam Brannen * @since 4.2 */ +@SuppressWarnings("deprecation") public class TimedSpringRuleTests extends TimedSpringRunnerTests { // All tests are in superclass. diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TimedTransactionalSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TimedTransactionalSpringRuleTests.java index 834ac9a72e4..cc273f066fe 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TimedTransactionalSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TimedTransactionalSpringRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2025 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. @@ -39,6 +39,7 @@ import static org.springframework.test.transaction.TransactionAssert.assertThatT * @since 4.2 */ @RunWith(JUnit4.class) +@SuppressWarnings("deprecation") public class TimedTransactionalSpringRuleTests extends TimedTransactionalSpringRunnerTests { @ClassRule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TransactionalSqlScriptsSpringRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TransactionalSqlScriptsSpringRuleTests.java index b3b1894464e..b58d8a8f779 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TransactionalSqlScriptsSpringRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/rules/TransactionalSqlScriptsSpringRuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2025 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. @@ -50,6 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat; @FixMethodOrder(MethodSorters.NAME_ASCENDING) @Sql({ "../../jdbc/schema.sql", "../../jdbc/data.sql" }) @DirtiesContext +@SuppressWarnings("deprecation") public class TransactionalSqlScriptsSpringRuleTests { @ClassRule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeoutTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeoutTests.java index e170ce12c6a..6d5f941ba18 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeoutTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeoutTests.java @@ -36,6 +36,7 @@ import static org.mockito.Mockito.mock; * @author Sam Brannen * @since 4.3.17 */ +@SuppressWarnings("deprecation") public class SpringFailOnTimeoutTests { private final Statement statement = mock(); diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/web/JUnit4SpringContextWebTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/web/JUnit4SpringContextWebTests.java index 170d7e39b4e..d18cbd9ae26 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/web/JUnit4SpringContextWebTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/web/JUnit4SpringContextWebTests.java @@ -46,6 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ContextConfiguration @WebAppConfiguration +@SuppressWarnings("deprecation") public class JUnit4SpringContextWebTests extends AbstractJUnit4SpringContextTests implements ServletContextAware { @Configuration