@Test(expected = BadChallengeException.class)
public void authenticate_with_BadChallengeException_from_authenticationContextValidator_test() {

    //Given
    byte[] credentialId = new byte[32];
    WebAuthnAuthenticatorImpl authenticator = mock(WebAuthnAuthenticatorImpl.class, RETURNS_DEEP_STUBS);
    WebAuthnAuthenticator webAuthnAuthenticator = mock(WebAuthnAuthenticator.class);
    when(authenticator.getAttestedCredentialData().getCredentialId()).thenReturn(credentialId);
    doThrow(com.webauthn4j.validator.exception.BadChallengeException.class).when(webAuthnManager).validate((AuthenticationRequest) any(), any());
    //When
    WebAuthnAuthenticationRequest request = mock(WebAuthnAuthenticationRequest.class);
    WebAuthnAuthenticationParameters parameters = mock(WebAuthnAuthenticationParameters.class);
    when(request.getCredentialId()).thenReturn(credentialId);
    when(authenticatorService.loadAuthenticatorByCredentialId(credentialId)).thenReturn(webAuthnAuthenticator);
    Authentication token = new WebAuthnAssertionAuthenticationToken(request, parameters, null);
    authenticationProvider.authenticate(token);
}