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