Skip to content

Commit 19c4e42

Browse files
scottshidlovskymarcusdacoregio
authored andcommitted
Update OpenSamlAuthenticationRequestResolverTests from Junit 4 to Junit 5
(cherry picked from commit 508f7d7)
1 parent 736f1c2 commit 19c4e42

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/authentication/OpenSamlAuthenticationRequestResolverTests.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package org.springframework.security.saml2.provider.service.web.authentication;
1818

19-
import org.junit.Before;
20-
import org.junit.Test;
19+
import org.junit.jupiter.api.BeforeEach;
20+
import org.junit.jupiter.api.Test;
2121
import org.opensaml.xmlsec.signature.support.SignatureConstants;
2222

2323
import org.springframework.mock.web.MockHttpServletRequest;
@@ -40,7 +40,7 @@ public class OpenSamlAuthenticationRequestResolverTests {
4040

4141
private RelyingPartyRegistration.Builder relyingPartyRegistrationBuilder;
4242

43-
@Before
43+
@BeforeEach
4444
public void setUp() {
4545
this.relyingPartyRegistrationBuilder = TestRelyingPartyRegistrations.relyingPartyRegistration();
4646
}
@@ -102,7 +102,9 @@ public void resolveAuthenticationRequestWhenSignedThenCredentialIsRequired() {
102102
.assertingPartyDetails((party) -> party.verificationX509Credentials((c) -> c.add(credential)))
103103
.build();
104104
OpenSamlAuthenticationRequestResolver resolver = authenticationRequestResolver(registration);
105-
assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> resolver.resolve(request, null));
105+
assertThatExceptionOfType(Saml2Exception.class)
106+
.isThrownBy(() -> resolver.resolve(request, (r, authnRequest) -> {
107+
}));
106108
}
107109

108110
@Test
@@ -161,7 +163,8 @@ public void resolveAuthenticationRequestWhenSHA1SignRequestThenSigns() {
161163
(party) -> party.signingAlgorithms((algs) -> algs.add(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1)))
162164
.build();
163165
OpenSamlAuthenticationRequestResolver resolver = authenticationRequestResolver(registration);
164-
Saml2RedirectAuthenticationRequest result = resolver.resolve(request, null);
166+
Saml2RedirectAuthenticationRequest result = resolver.resolve(request, (r, authnRequest) -> {
167+
});
165168
assertThat(result.getSamlRequest()).isNotEmpty();
166169
assertThat(result.getRelayState()).isNotNull();
167170
assertThat(result.getSigAlg()).isEqualTo(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);

0 commit comments

Comments
 (0)