Skip to content

Commit 983a746

Browse files
Kehrlannjgrandja
authored andcommitted
Polish ProviderSettingsTests
Issue spring-projectsgh-167
1 parent d928f69 commit 983a746

File tree

1 file changed

+19
-19
lines changed
  • oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/config

1 file changed

+19
-19
lines changed

oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/config/ProviderSettingsTests.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.junit.Test;
1919

2020
import static org.assertj.core.api.Assertions.assertThat;
21-
import static org.assertj.core.api.Assertions.assertThatThrownBy;
21+
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
2222

2323
/**
2424
* Tests for {@link ProviderSettings}.
@@ -78,48 +78,48 @@ public void settingWhenCustomThenReturnAllSettings() {
7878
@Test
7979
public void issuerWhenNullThenThrowIllegalArgumentException() {
8080
ProviderSettings settings = new ProviderSettings();
81-
assertThatThrownBy(() -> settings.issuer(null))
82-
.isInstanceOf(IllegalArgumentException.class)
83-
.hasMessage("value cannot be null");
81+
assertThatIllegalArgumentException()
82+
.isThrownBy(() -> settings.issuer(null))
83+
.withMessage("value cannot be null");
8484
}
8585

8686
@Test
8787
public void authorizationEndpointWhenNullThenThrowIllegalArgumentException() {
8888
ProviderSettings settings = new ProviderSettings();
89-
assertThatThrownBy(() -> settings.authorizationEndpoint(null))
90-
.isInstanceOf(IllegalArgumentException.class)
91-
.hasMessage("value cannot be null");
89+
assertThatIllegalArgumentException()
90+
.isThrownBy(() -> settings.authorizationEndpoint(null))
91+
.withMessage("value cannot be null");
9292
}
9393

9494
@Test
9595
public void tokenEndpointWhenNullThenThrowIllegalArgumentException() {
9696
ProviderSettings settings = new ProviderSettings();
97-
assertThatThrownBy(() -> settings.tokenEndpoint(null))
98-
.isInstanceOf(IllegalArgumentException.class)
99-
.hasMessage("value cannot be null");
97+
assertThatIllegalArgumentException()
98+
.isThrownBy(() -> settings.tokenEndpoint(null))
99+
.withMessage("value cannot be null");
100100
}
101101

102102
@Test
103103
public void tokenRevocationEndpointWhenNullThenThrowIllegalArgumentException() {
104104
ProviderSettings settings = new ProviderSettings();
105-
assertThatThrownBy(() -> settings.tokenRevocationEndpoint(null))
106-
.isInstanceOf(IllegalArgumentException.class)
107-
.hasMessage("value cannot be null");
105+
assertThatIllegalArgumentException()
106+
.isThrownBy(() -> settings.tokenRevocationEndpoint(null))
107+
.withMessage("value cannot be null");
108108
}
109109

110110
@Test
111111
public void tokenIntrospectionEndpointWhenNullThenThrowIllegalArgumentException() {
112112
ProviderSettings settings = new ProviderSettings();
113-
assertThatThrownBy(() -> settings.tokenIntrospectionEndpoint(null))
114-
.isInstanceOf(IllegalArgumentException.class)
115-
.hasMessage("value cannot be null");
113+
assertThatIllegalArgumentException()
114+
.isThrownBy(() -> settings.tokenIntrospectionEndpoint(null))
115+
.withMessage("value cannot be null");
116116
}
117117

118118
@Test
119119
public void jwksEndpointWhenNullThenThrowIllegalArgumentException() {
120120
ProviderSettings settings = new ProviderSettings();
121-
assertThatThrownBy(() -> settings.jwkSetEndpoint(null))
122-
.isInstanceOf(IllegalArgumentException.class)
123-
.hasMessage("value cannot be null");
121+
assertThatIllegalArgumentException()
122+
.isThrownBy(() -> settings.jwkSetEndpoint(null))
123+
.withMessage("value cannot be null");
124124
}
125125
}

0 commit comments

Comments
 (0)