@Override
    public MultifactorAuthenticationDeviceManager getDeviceManager() {
        val manager = mock(MultifactorAuthenticationDeviceManager.class);
        val listOfDevices = CollectionUtils.wrapList(
            MultifactorAuthenticationRegisteredDevice.builder()
                .name(UUID.randomUUID().toString())
                .id(UUID.randomUUID().toString())
                .number(UUID.randomUUID().toString())
                .type("Test")
                .source("TestMfaProvider")
                .build());
        when(manager.findRegisteredDevices(argThat(principal -> !"user-without-devices".equalsIgnoreCase(principal.getId())))).thenReturn(listOfDevices);
        doAnswer(r -> {
            val deviceId = r.getArgument(1, String.class);
            listOfDevices.removeIf(device -> device.getId().equals(deviceId));
            return null;
        }).when(manager).removeRegisteredDevice(any(Principal.class), anyString());
        when(manager.getSource()).thenReturn(List.of("TestMfaProvider"));
        return manager;
    }
This is {@link TestMultifactorAuthenticationProvider}.

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