From a558f06234f0b8fb885c5e9b1843dfe88edb2d0b Mon Sep 17 00:00:00 2001 From: abdlatif-nabgha Date: Sun, 24 May 2026 10:08:43 +0100 Subject: [PATCH 1/3] Fix typo in test method See gh-50492 Signed-off-by: abdlatif-nabgha --- .../boot/web/servlet/AbstractFilterRegistrationBeanTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java index 6f984994c468..af99c5c237ca 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java @@ -226,7 +226,7 @@ private void doubleRegistration() throws ServletException { } @Test - void doesntFailIfDoubleRegistrationIsIgnored() { + void doesNotFailIfDoubleRegistrationIsIgnored() { assertThatCode(() -> { AbstractFilterRegistrationBean bean = createFilterRegistrationBean(); bean.setName("double-registration"); From bd9794a7e587dc5f2e1206bba906aeab04e6c0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Mon, 25 May 2026 17:06:24 +0200 Subject: [PATCH 2/3] Polish "Fix typo in test method" See gh-50492 --- .../devtools/remote/client/RemoteClientConfigurationTests.java | 2 +- .../boot/devtools/restart/SilentExitExceptionHandlerTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java index df8594318707..4063bbaf617f 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java @@ -90,7 +90,7 @@ void warnIfNotHttps(CapturedOutput output) { } @Test - void doesntWarnIfUsingHttps(CapturedOutput output) { + void doesNotWarnIfUsingHttps(CapturedOutput output) { configure("https://localhost", true); assertThat(output).doesNotContain("is insecure"); } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/SilentExitExceptionHandlerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/SilentExitExceptionHandlerTests.java index 73602974fb7e..c6b9a0f02c6b 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/SilentExitExceptionHandlerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/SilentExitExceptionHandlerTests.java @@ -46,7 +46,7 @@ public void run() { } @Test - void doesntInterfereWithOtherExceptions() throws Exception { + void doesNotInterfereWithOtherExceptions() throws Exception { TestThread testThread = new TestThread() { @Override public void run() { From f91c8b659c9e0dd3eac5bd6f18fba305e12b1039 Mon Sep 17 00:00:00 2001 From: Stefano Cordio Date: Mon, 18 May 2026 17:52:08 +0200 Subject: [PATCH 3/3] Add missing null check in ApplicationContextAssertProvider See gh-50456 Signed-off-by: Stefano Cordio --- .../ApplicationContextAssertProvider.java | 5 ++-- ...ApplicationContextAssertProviderTests.java | 27 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java index 1d4910a77101..1d5a1208cf54 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java @@ -55,8 +55,8 @@ public interface ApplicationContextAssertProvider extends ApplicationContext, AssertProvider>, Closeable { /** - * Return an assert for AspectJ. - * @return an AspectJ assert + * Return an assert for AssertJ. + * @return an AssertJ assert * @deprecated to prevent accidental use. Prefer standard AssertJ * {@code assertThat(context)...} calls instead. */ @@ -131,6 +131,7 @@ static , C extends ApplicationCont Assert.isTrue(type.isInterface(), "'type' must be an interface"); Assert.notNull(contextType, "'contextType' must not be null"); Assert.isTrue(contextType.isInterface(), "'contextType' must be an interface"); + Assert.notNull(contextSupplier, "'contextSupplier' must not be null"); Class[] interfaces = merge(new Class[] { type, contextType }, additionalContextInterfaces); return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new AssertProviderApplicationContextInvocationHandler(contextType, contextSupplier)); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java index 6bd5a7103678..44f511f002c1 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java @@ -20,9 +20,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; @@ -32,6 +29,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.mockito.BDDMockito.then; +import static org.mockito.Mockito.mock; /** * Tests for {@link ApplicationContextAssertProvider} and @@ -39,11 +37,9 @@ * * @author Phillip Webb */ -@ExtendWith(MockitoExtension.class) class ApplicationContextAssertProviderTests { - @Mock - private ConfigurableApplicationContext mockContext; + private final ConfigurableApplicationContext mockContext = mock(); private RuntimeException startupFailure; @@ -69,13 +65,6 @@ void getWhenTypeIsNullShouldThrowException() { @Test void getWhenTypeIsClassShouldThrowException() { - assertThatIllegalArgumentException().isThrownBy( - () -> ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier)) - .withMessageContaining("'type' must not be null"); - } - - @Test - void getWhenContextTypeIsNullShouldThrowException() { assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get(TestAssertProviderApplicationContextClass.class, ApplicationContext.class, this.mockContextSupplier)) @@ -83,7 +72,7 @@ void getWhenContextTypeIsNullShouldThrowException() { } @Test - void getWhenContextTypeIsClassShouldThrowException() { + void getWhenContextTypeIsNullShouldThrowException() { assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, null, this.mockContextSupplier)) @@ -91,13 +80,21 @@ void getWhenContextTypeIsClassShouldThrowException() { } @Test - void getWhenSupplierIsNullShouldThrowException() { + void getWhenContextTypeIsClassShouldThrowException() { assertThatIllegalArgumentException() .isThrownBy(() -> ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, StaticApplicationContext.class, this.mockContextSupplier)) .withMessageContaining("'contextType' must be an interface"); } + @Test + void getWhenSupplierIsNullShouldThrowException() { + assertThatIllegalArgumentException() + .isThrownBy(() -> ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, + ApplicationContext.class, null)) + .withMessageContaining("'contextSupplier' must not be null"); + } + @Test void getWhenContextStartsShouldReturnProxyThatCallsRealMethods() { ApplicationContextAssertProvider context = get(this.mockContextSupplier);