package org.apereo.cas.trusted.web;

import org.apereo.cas.trusted.config.MultifactorAuthnTrustConfiguration;
import org.apereo.cas.web.report.AbstractCasEndpointTests;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.test.context.TestPropertySource;

import static org.junit.jupiter.api.Assertions.*;

/**
 * This is {@link MultifactorTrustedDevicesReportEndpointTests}.
 *
 * @author Misagh Moayyed
 * @since 6.2.0
 */
@TestPropertySource(properties = {
    "management.endpoint.multifactorTrustedDevices.enabled=true"
})
@Tag("MFA")
@ImportAutoConfiguration(MultifactorAuthnTrustConfiguration.class)
public class MultifactorTrustedDevicesReportEndpointTests extends AbstractCasEndpointTests {

    @Autowired
    @Qualifier("mfaTrustedDevicesReportEndpoint")
    private MultifactorTrustedDevicesReportEndpoint endpoint;

    @Test
    public void verifyOperation() {
        assertNotNull(endpoint);
    }
}

@@ -30,16 +30,191 @@
 d.web;%0A%0A
+import org.apereo.cas.trusted.authentication.api.MultifactorAuthenticationTrustRecord;%0Aimport org.apereo.cas.trusted.authentication.api.MultifactorAuthenticationTrustStorage;%0A
 import o
@@ -338,16 +338,35 @@
 Tests;%0A%0A
+import lombok.val;%0A
 import o
@@ -885,22 +885,16 @@
 erties =
- %7B%0A   
  %22manage
@@ -946,18 +946,16 @@
 ed=true%22
-%0A%7D
 )%0A@Tag(%22
@@ -1258,79 +1258,619 @@
    @
-Test%0A    public void verifyOperation() %7B%0A        assertNotNull(endpoint
+Autowired%0A    @Qualifier(%22mfaTrustEngine%22)%0A    private MultifactorAuthenticationTrustStorage mfaTrustEngine;%0A%0A    @Test%0A    public void verifyOperation() %7B%0A        assertNotNull(endpoint);%0A        val record = mfaTrustEngine.set(MultifactorAuthenticationTrustRecord.newInstance(%22casuser%22,%0A            %22geography%22, %22fingerprint%22));%0A        assertFalse(endpoint.devices().isEmpty());%0A        assertFalse(endpoint.devicesForUser(%22casuser%22).isEmpty());%0A%0A        endpoint.revoke(record.getRecordKey());%0A        assertTrue(endpoint.devices().isEmpty());%0A        assertTrue(endpoint.devicesForUser(%22casuser%22).isEmpty()
 );%0A 

add tests