|
54 | 54 | import org.springframework.security.core.Authentication;
|
55 | 55 | import org.springframework.security.saml2.credentials.Saml2X509Credential;
|
56 | 56 |
|
57 |
| -import static org.junit.Assert.assertEquals; |
58 |
| -import static org.junit.Assert.assertTrue; |
| 57 | +import static org.assertj.core.api.Assertions.assertThat; |
59 | 58 | import static org.mockito.ArgumentMatchers.any;
|
60 | 59 | import static org.mockito.Mockito.atLeastOnce;
|
61 | 60 | import static org.mockito.Mockito.mock;
|
@@ -95,18 +94,16 @@ public class OpenSamlAuthenticationProviderTests {
|
95 | 94 | @Test
|
96 | 95 | public void supportsWhenSaml2AuthenticationTokenThenReturnTrue() {
|
97 | 96 |
|
98 |
| - assertTrue( |
99 |
| - OpenSamlAuthenticationProvider.class + "should support " + Saml2AuthenticationToken.class, |
100 |
| - this.provider.supports(Saml2AuthenticationToken.class) |
101 |
| - ); |
| 97 | + assertThat(this.provider.supports(Saml2AuthenticationToken.class)) |
| 98 | + .withFailMessage(OpenSamlAuthenticationProvider.class + "should support " + Saml2AuthenticationToken.class) |
| 99 | + .isTrue(); |
102 | 100 | }
|
103 | 101 |
|
104 | 102 | @Test
|
105 | 103 | public void supportsWhenNotSaml2AuthenticationTokenThenReturnFalse() {
|
106 |
| - assertTrue( |
107 |
| - OpenSamlAuthenticationProvider.class + "should not support " + Authentication.class, |
108 |
| - !this.provider.supports(Authentication.class) |
109 |
| - ); |
| 104 | + assertThat(!this.provider.supports(Authentication.class)) |
| 105 | + .withFailMessage(OpenSamlAuthenticationProvider.class + "should not support " + Authentication.class) |
| 106 | + .isTrue(); |
110 | 107 | }
|
111 | 108 |
|
112 | 109 | @Test
|
@@ -237,8 +234,8 @@ public void authenticateWhenAssertionContainsAttributesThenItSucceeds() {
|
237 | 234 | Instant registeredDate = Instant.ofEpochMilli(DateTime.parse("1970-01-01T00:00:00Z").getMillis());
|
238 | 235 | expected.put("registeredDate", Collections.singletonList(registeredDate));
|
239 | 236 |
|
240 |
| - assertEquals("John Doe", principal.getFirstAttribute("name")); |
241 |
| - assertEquals(expected, principal.getAttributes()); |
| 237 | + assertThat((String) principal.getFirstAttribute("name")).isEqualTo("John Doe"); |
| 238 | + assertThat(principal.getAttributes()).isEqualTo(expected); |
242 | 239 | }
|
243 | 240 |
|
244 | 241 | @Test
|
|
0 commit comments