From b8796d84b7ba8d1497ed614390bb4f166d466a6f Mon Sep 17 00:00:00 2001 From: Joe Grandja <10884212+jgrandja@users.noreply.github.com> Date: Wed, 16 Jul 2025 17:00:14 -0400 Subject: [PATCH] Fix tests in ClientRegistrationsTests Issue gh-17542 --- .../client/registration/ClientRegistrationsTests.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTests.java index bdce5512a5..6cea9cb1b2 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTests.java @@ -40,6 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.assertj.core.api.Assertions.assertThatNullPointerException; /** * @author Rob Winch @@ -182,16 +183,14 @@ public class ClientRegistrationsTests { @Test public void issuerWhenResponseMissingJwksUriThenThrowsIllegalArgumentException() throws Exception { this.response.remove("jwks_uri"); - assertThatIllegalArgumentException().isThrownBy(() -> registration("").build()) - .withMessageContaining("The public JWK set URI must not be null"); + assertThatIllegalArgumentException().isThrownBy(() -> registration("").build()); } // gh-7512 @Test public void issuerWhenOidcFallbackResponseMissingJwksUriThenThrowsIllegalArgumentException() throws Exception { this.response.remove("jwks_uri"); - assertThatIllegalArgumentException().isThrownBy(() -> registrationOidcFallback("issuer1", null).build()) - .withMessageContaining("The public JWK set URI must not be null"); + assertThatIllegalArgumentException().isThrownBy(() -> registrationOidcFallback("issuer1", null).build()); } // gh-7512 @@ -476,8 +475,7 @@ public class ClientRegistrationsTests { @Test public void issuerWhenOidcConfigurationResponseMissingJwksUriThenThrowsIllegalArgumentException() throws Exception { this.response.remove("jwks_uri"); - assertThatIllegalArgumentException().isThrownBy(() -> registration(this.response).build()) - .withMessageContaining("The public JWK set URI must not be null"); + assertThatNullPointerException().isThrownBy(() -> registration(this.response).build()); } @Test