From 6642bf7beb33ca7590fa3f36430aaf9ab21bc800 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 17 Sep 2025 16:40:32 -0700 Subject: [PATCH] Deprecate JUnit 4 OutputCaptureRule Closes gh-47256 --- .../org/springframework/boot/test/system/OutputCaptureRule.java | 2 ++ .../boot/test/system/OutputCaptureRuleTests.java | 1 + 2 files changed, 3 insertions(+) diff --git a/core/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java b/core/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java index d3d25316727..d8975f3d78c 100644 --- a/core/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java +++ b/core/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java @@ -50,7 +50,9 @@ import static org.hamcrest.Matchers.allOf; * @author Phillip Webb * @author Andy Wilkinson * @since 2.2.0 + * @deprecated since 4.0.0 in favor of JUnit 5 and {@link OutputCaptureExtension} */ +@Deprecated public class OutputCaptureRule implements TestRule, CapturedOutput { private final OutputCapture delegate = new OutputCapture(); diff --git a/core/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureRuleTests.java b/core/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureRuleTests.java index 80e683ab377..ace537bc7f8 100644 --- a/core/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureRuleTests.java +++ b/core/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureRuleTests.java @@ -26,6 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Roland Weisleder */ +@SuppressWarnings("deprecation") public class OutputCaptureRuleTests { @Rule