@Test
        void verifyAction() throws Throwable {
            val repository = new InMemoryPasswordlessTokenRepository(60, CipherExecutor.noOpOfSerializableToString());

            val uid = UUID.randomUUID().toString();
            val passwordlessUserAccount = PasswordlessUserAccount.builder().username(uid).build();
            val passwordlessRequest = PasswordlessAuthenticationRequest.builder().username(uid).build();
            var token = repository.createToken(passwordlessUserAccount, passwordlessRequest);
            token = repository.saveToken(passwordlessUserAccount, passwordlessRequest, token);
            val handler = new PasswordlessTokenAuthenticationHandler(null,
                mock(ServicesManager.class),
                PrincipalFactoryUtils.newPrincipalFactory(), 0, repository);
            val credential = new OneTimePasswordCredential(uid, token.getToken());
            credential.setCredentialMetadata(new BasicCredentialMetadata(credential));
            assertNotNull(handler.authenticate(credential, mock(Service.class)));

            assertThrows(FailedLoginException.class,
                () -> handler.authenticate(new OneTimePasswordCredential("1", "2"), mock(Service.class)));
            assertThrows(FailedLoginException.class,
                () -> handler.authenticate(new OneTimePasswordCredential(credential.getId(), "123456"), mock(Service.class)));

            assertTrue(handler.supports(credential));
            assertTrue(handler.supports(credential.getCredentialMetadata().getCredentialClass()));
            assertFalse(handler.supports(new UsernamePasswordCredential()));
        }
This is {@link PasswordlessTokenAuthenticationHandlerTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-passwordless-authentication/src/test/java/org/apereo/cas/authentication/PasswordlessTokenAuthenticationHandlerTests.java