private static DuoSecurityMultifactorAuthenticationProvider buildProvider(
            final CasConfigurationProperties casProperties, final DuoSecurityUserAccountStatus status) {
            val id = "mfa-%s".formatted(UUID.randomUUID().toString());

            val authentication = CoreAuthenticationTestUtils.getAuthentication();
            val provider = mock(DuoSecurityMultifactorAuthenticationProvider.class);
            val account = new DuoSecurityUserAccount(authentication.getPrincipal().getId());
            account.setStatus(status);
            account.setEnrollPortalUrl("https://example.org");
            val properties = new DuoSecurityMultifactorAuthenticationRegistrationProperties();
            val registration = properties.setRegistrationUrl("https://registration.duo.com");
            registration.getCrypto().setEnabled(true);
            when(provider.getRegistration()).thenReturn(registration);

            when(provider.matches(anyString())).thenAnswer(answer -> answer.getArgument(0, String.class).equalsIgnoreCase(id));
            val duoService = mock(DuoSecurityAuthenticationService.class);
            when(duoService.getUserAccount(anyString())).thenReturn(account);
            when(duoService.getProperties()).thenReturn(casProperties.getAuthn().getMfa().getDuo().getFirst());
            when(provider.getId()).thenReturn(id);
            when(provider.getDuoAuthenticationService()).thenReturn(duoService);
            return provider;
        }
This is {@link DuoSecurityDetermineUserAccountActionTests}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-duo/src/test/java/org/apereo/cas/adaptors/duo/web/flow/action/DuoSecurityDetermineUserAccountActionTests.java