From 2712a7b86c688f6a49058498fcca0cb720540007 Mon Sep 17 00:00:00 2001 From: Daniel Garnier-Moiroux Date: Tue, 10 Nov 2020 11:59:00 +0100 Subject: [PATCH] Polish ProviderSettingsTests Issue gh-167 --- .../config/ProviderSettingsTests.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/config/ProviderSettingsTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/config/ProviderSettingsTests.java index 1c9ae660..3997f2cf 100644 --- a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/config/ProviderSettingsTests.java +++ b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/config/ProviderSettingsTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.server.authorization.config; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; /** * Tests for {@link ProviderSettings}. @@ -78,48 +78,48 @@ public class ProviderSettingsTests { @Test public void issuerWhenNullThenThrowIllegalArgumentException() { ProviderSettings settings = new ProviderSettings(); - assertThatThrownBy(() -> settings.issuer(null)) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("value cannot be null"); + assertThatIllegalArgumentException() + .isThrownBy(() -> settings.issuer(null)) + .withMessage("value cannot be null"); } @Test public void authorizationEndpointWhenNullThenThrowIllegalArgumentException() { ProviderSettings settings = new ProviderSettings(); - assertThatThrownBy(() -> settings.authorizationEndpoint(null)) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("value cannot be null"); + assertThatIllegalArgumentException() + .isThrownBy(() -> settings.authorizationEndpoint(null)) + .withMessage("value cannot be null"); } @Test public void tokenEndpointWhenNullThenThrowIllegalArgumentException() { ProviderSettings settings = new ProviderSettings(); - assertThatThrownBy(() -> settings.tokenEndpoint(null)) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("value cannot be null"); + assertThatIllegalArgumentException() + .isThrownBy(() -> settings.tokenEndpoint(null)) + .withMessage("value cannot be null"); } @Test public void tokenRevocationEndpointWhenNullThenThrowIllegalArgumentException() { ProviderSettings settings = new ProviderSettings(); - assertThatThrownBy(() -> settings.tokenRevocationEndpoint(null)) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("value cannot be null"); + assertThatIllegalArgumentException() + .isThrownBy(() -> settings.tokenRevocationEndpoint(null)) + .withMessage("value cannot be null"); } @Test public void tokenIntrospectionEndpointWhenNullThenThrowIllegalArgumentException() { ProviderSettings settings = new ProviderSettings(); - assertThatThrownBy(() -> settings.tokenIntrospectionEndpoint(null)) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("value cannot be null"); + assertThatIllegalArgumentException() + .isThrownBy(() -> settings.tokenIntrospectionEndpoint(null)) + .withMessage("value cannot be null"); } @Test public void jwksEndpointWhenNullThenThrowIllegalArgumentException() { ProviderSettings settings = new ProviderSettings(); - assertThatThrownBy(() -> settings.jwkSetEndpoint(null)) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("value cannot be null"); + assertThatIllegalArgumentException() + .isThrownBy(() -> settings.jwkSetEndpoint(null)) + .withMessage("value cannot be null"); } }