@Test
    void verifyOperation() {
        val provider = mock(MultifactorAuthenticationProvider.class);
        when(provider.getFailureMode()).thenReturn(MultifactorAuthenticationProviderFailureModes.PHANTOM);
        when(provider.getId()).thenReturn("mfa-dummy");
        when(provider.getFailureModeEvaluator()).thenReturn(
            new DefaultMultifactorAuthenticationFailureModeEvaluator(new CasConfigurationProperties()));
        when(provider.isAvailable(any())).thenReturn(false);

        val servicesManager = mock(ServicesManager.class);
        val populator = new MultifactorAuthenticationProviderMetadataPopulator("contextClass",
            new DirectObjectProvider<>(provider), servicesManager);
        assertTrue(populator.supports(CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword()));

        val builder = CoreAuthenticationTestUtils.getAuthenticationBuilder();
        populator.populateAttributes(builder, CoreAuthenticationTestUtils.getAuthenticationTransactionFactory()
            .newTransaction(new UsernamePasswordCredential()));
        val authn = builder.build();
        assertTrue(authn.containsAttribute("contextClass"));
    }
This is {@link MultifactorAuthenticationProviderMetadataPopulatorTests}.

@author Misagh Moayyed
@since 6.6.0
core/cas-server-core-authentication-api/src/test/java/org/apereo/cas/authentication/MultifactorAuthenticationProviderMetadataPopulatorTests.java