@Test
    void verifyOperation() throws Throwable {
        val id1 = UUID.randomUUID().toString();
        register(RegisteredServiceTestUtils.getAuthentication(id1));

        val id2 = UUID.randomUUID().toString();
        register(RegisteredServiceTestUtils.getAuthentication(id2));

        assertFalse(webAuthnRegisteredDevicesEndpoint.fetch(id1).isEmpty());
        assertFalse(webAuthnRegisteredDevicesEndpoint.fetch(id2).isEmpty());
        
        var principal = RegisteredServiceTestUtils.getPrincipal(id1);
        val devices = webAuthnMultifactorAuthenticationProvider.getDeviceManager().findRegisteredDevices(principal);
        assertEquals(1, devices.size());
        
        webAuthnRegisteredDevicesEndpoint.delete(id1, id1);
        assertTrue(webAuthnRegisteredDevicesEndpoint.fetch(id1).isEmpty());

        webAuthnRegisteredDevicesEndpoint.delete(id2);
        assertTrue(webAuthnRegisteredDevicesEndpoint.fetch(id1).isEmpty());
        assertTrue(webAuthnRegisteredDevicesEndpoint.fetch(id2).isEmpty());

        val id3 = UUID.randomUUID().toString();
        val record = getCredentialRegistration(RegisteredServiceTestUtils.getAuthentication(id3));
        assertTrue(webAuthnRegisteredDevicesEndpoint.write(id3,
            EncodingUtils.encodeBase64(WebAuthnUtils.getObjectMapper().writeValueAsString(record))));

        val id4 = UUID.randomUUID().toString();
        principal = RegisteredServiceTestUtils.getPrincipal(id4);
        val registration = register(RegisteredServiceTestUtils.getAuthentication(id4));
        webAuthnMultifactorAuthenticationProvider.getDeviceManager().removeRegisteredDevice(principal,
            registration.getCredential().getCredentialId().getBase64Url());
        assertFalse(webAuthnMultifactorAuthenticationProvider.getDeviceManager().hasRegisteredDevices(principal));
    }
This is {@link WebAuthnRegisteredDevicesEndpointTests}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-webauthn/src/test/java/org/apereo/cas/webauthn/web/WebAuthnRegisteredDevicesEndpointTests.java