@Test
    void verifyAuthnTokenScratchCode() throws Throwable {
        val credential = getGoogleAuthenticatorTokenCredential();
        val toSave = GoogleAuthenticatorAccount.builder()
            .username("casuser")
            .name(UUID.randomUUID().toString())
            .secretKey(account.getKey())
            .validationCode(account.getVerificationCode())
            .scratchCodes(new ArrayList<>(account.getScratchCodes()))
            .build();
        tokenCredentialRepository.save(toSave);
        credential.setAccountId(toSave.getId());
        credential.setToken(Integer.toString(account.getScratchCodes().getFirst()));
        val result = handler.authenticate(credential, mock(Service.class));
        assertNotNull(result);
        val otp = Integer.valueOf(credential.getToken());
        assertNotNull(tokenRepository.get("casuser", otp));
        assertFalse(tokenCredentialRepository.get("casuser").iterator().next().getScratchCodes().contains(otp));
    }
This is {@link GoogleAuthenticatorAuthenticationHandlerTests}.

@author Misagh Moayyed
@since 6.0.0
support/cas-server-support-gauth-core/src/test/java/org/apereo/cas/gauth/GoogleAuthenticatorAuthenticationHandlerTests.java