Skip to content

Commit aeb8c2d

Browse files
committed
Update Test to Align with webauthn4j
The latest webauthn4j exposes Jackson 3 instead of Jackson 2, as such this test now uses Jackson 3 where needed.
1 parent fc83e5c commit aeb8c2d

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

webauthn/src/test/java/org/springframework/security/web/webauthn/management/Webauthn4jRelyingPartyOperationsTests.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
import org.mockito.ArgumentCaptor;
4444
import org.mockito.Mock;
4545
import org.mockito.junit.jupiter.MockitoExtension;
46+
import tools.jackson.databind.json.JsonMapper;
47+
import tools.jackson.dataformat.cbor.CBORMapper;
4648

4749
import org.springframework.security.authentication.AnonymousAuthenticationToken;
4850
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -78,6 +80,7 @@
7880
import static org.assertj.core.api.Assertions.assertThatRuntimeException;
7981
import static org.mockito.ArgumentMatchers.any;
8082
import static org.mockito.BDDMockito.given;
83+
import static org.mockito.Mockito.RETURNS_SELF;
8184
import static org.mockito.Mockito.mock;
8285
import static org.mockito.Mockito.verifyNoInteractions;
8386

@@ -613,9 +616,11 @@ void authenticateThenWa4jRequestCredentialIdIsRawIdBytes() throws Exception {
613616

614617
ImmutableCredentialRecord credentialRecord = TestCredentialRecords.fullUserCredential().build();
615618
given(this.userCredentials.findByCredentialId(publicKey.getRawId())).willReturn(credentialRecord);
616-
ObjectMapper json = mock(ObjectMapper.class);
617-
ObjectMapper cbor = mock(ObjectMapper.class);
618-
given(cbor.getFactory()).willReturn(mock(CBORFactory.class));
619+
JsonMapper json = new JsonMapper();
620+
CBORMapper cbor = mock(CBORMapper.class);
621+
CBORMapper.Builder builder = mock(CBORMapper.Builder.class, RETURNS_SELF);
622+
given(builder.build()).willReturn(cbor);
623+
given(cbor.rebuild()).willReturn(builder);
619624
AttestationObject attestationObject = mock(AttestationObject.class);
620625
AuthenticatorData wa4jAuthData = mock(AuthenticatorData.class);
621626
given(attestationObject.getAuthenticatorData()).willReturn(wa4jAuthData);

0 commit comments

Comments
 (0)