From 19c4e427ee27ca66482eb8849515b2c0e3f99f74 Mon Sep 17 00:00:00 2001 From: Scott Shidlovsky Date: Tue, 17 Oct 2023 09:35:16 -0300 Subject: [PATCH] Update OpenSamlAuthenticationRequestResolverTests from Junit 4 to Junit 5 (cherry picked from commit 508f7d7b8a42a3be34c7919d03d85b64c35d0794) --- .../OpenSamlAuthenticationRequestResolverTests.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/authentication/OpenSamlAuthenticationRequestResolverTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/authentication/OpenSamlAuthenticationRequestResolverTests.java index 2f5f96ef16..d314a0166d 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/authentication/OpenSamlAuthenticationRequestResolverTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/authentication/OpenSamlAuthenticationRequestResolverTests.java @@ -16,8 +16,8 @@ package org.springframework.security.saml2.provider.service.web.authentication; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opensaml.xmlsec.signature.support.SignatureConstants; import org.springframework.mock.web.MockHttpServletRequest; @@ -40,7 +40,7 @@ public class OpenSamlAuthenticationRequestResolverTests { private RelyingPartyRegistration.Builder relyingPartyRegistrationBuilder; - @Before + @BeforeEach public void setUp() { this.relyingPartyRegistrationBuilder = TestRelyingPartyRegistrations.relyingPartyRegistration(); } @@ -102,7 +102,9 @@ public class OpenSamlAuthenticationRequestResolverTests { .assertingPartyDetails((party) -> party.verificationX509Credentials((c) -> c.add(credential))) .build(); OpenSamlAuthenticationRequestResolver resolver = authenticationRequestResolver(registration); - assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> resolver.resolve(request, null)); + assertThatExceptionOfType(Saml2Exception.class) + .isThrownBy(() -> resolver.resolve(request, (r, authnRequest) -> { + })); } @Test @@ -161,7 +163,8 @@ public class OpenSamlAuthenticationRequestResolverTests { (party) -> party.signingAlgorithms((algs) -> algs.add(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1))) .build(); OpenSamlAuthenticationRequestResolver resolver = authenticationRequestResolver(registration); - Saml2RedirectAuthenticationRequest result = resolver.resolve(request, null); + Saml2RedirectAuthenticationRequest result = resolver.resolve(request, (r, authnRequest) -> { + }); assertThat(result.getSamlRequest()).isNotEmpty(); assertThat(result.getRelayState()).isNotNull(); assertThat(result.getSigAlg()).isEqualTo(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);