public static Authentication getAuthentication(final Principal principal, final Map<String, List<Object>> attributes) {
        val authentication = mock(Authentication.class);
        when(authentication.getAttributes()).thenReturn(attributes);
        when(authentication.getPrincipal()).thenReturn(principal);

        val credentialMetadata = mock(CredentialMetadata.class);
        when(credentialMetadata.getCredentialClass()).thenReturn((Class) Credential.class);

        val credential = mock(Credential.class);
        when(credential.getCredentialMetadata()).thenReturn(credentialMetadata);
        when(authentication.getCredentials()).thenReturn(CollectionUtils.wrapList(credential));
        return authentication;
    }
This is {@link MultifactorAuthenticationTestUtils}.

@author Misagh Moayyed
@since 5.2.0
core/cas-server-core-authentication-mfa-api/src/test/java/org/apereo/cas/authentication/mfa/MultifactorAuthenticationTestUtils.java