@Test
    void verifyStartAuthentication() throws Throwable {
        val authenticatedPrincipal = new TestingAuthenticationToken("casuser", List.of());
        val server = mock(WebAuthnServer.class);
        val controller = new WebAuthnController(server);

        when(server.startAuthentication(any())).thenReturn(Either.left(List.of("failed")));
        var result = controller.startAuthentication(authenticatedPrincipal);
        assertEquals(HttpStatus.BAD_REQUEST, result.getStatusCode());

        val publicKeyRequest = PublicKeyCredentialRequestOptions.builder()
            .challenge(ByteArray.fromBase64Url(RandomUtils.randomAlphabetic(8)))
            .rpId("localhost")
            .timeout(100)
            .build();

        val assertionRequest = AssertionRequest.builder()
            .publicKeyCredentialRequestOptions(publicKeyRequest)
            .username("casuser")
            .build();

        val assertion = new AssertionRequestWrapper(
            ByteArray.fromBase64Url(RandomUtils.randomAlphabetic(8)),
            assertionRequest);

        when(server.startAuthentication(any())).thenReturn(Either.right(assertion));
        
        result = controller.startAuthentication(authenticatedPrincipal);
        assertEquals(HttpStatus.OK, result.getStatusCode());
    }
This is {@link WebAuthnControllerTests}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-webauthn-core/src/test/java/org/apereo/cas/webauthn/WebAuthnControllerTests.java