@Test
    void verifyOperation() {
        ApplicationContextProvider.holdApplicationContext(applicationContext);

        val duoService = mock(DuoSecurityAuthenticationService.class);
        when(duoService.ping()).thenReturn(true);

        val props = new DuoSecurityMultifactorAuthenticationProperties()
            .setDuoApiHost("https://api.duosecurity.com");
        when(duoService.getProperties()).thenReturn(props);

        val bean = mock(DuoSecurityMultifactorAuthenticationProvider.class);
        when(bean.getId()).thenReturn(DuoSecurityMultifactorAuthenticationProperties.DEFAULT_IDENTIFIER);
        when(bean.getDuoAuthenticationService()).thenReturn(duoService);
        when(bean.matches(eq(DuoSecurityMultifactorAuthenticationProperties.DEFAULT_IDENTIFIER))).thenReturn(true);
        ApplicationContextProvider.registerBeanIntoApplicationContext(applicationContext, bean, "duoProvider");

        val indicator = new DuoSecurityPingEndpoint(casProperties, this.applicationContext);
        val result = indicator.pingDuo(DuoSecurityMultifactorAuthenticationProperties.DEFAULT_IDENTIFIER);
        assertNotNull(result);
        assertTrue(result.containsKey(DuoSecurityMultifactorAuthenticationProperties.DEFAULT_IDENTIFIER));
    }
This is {@link DuoSecurityPingEndpointTests}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-duo-core/src/test/java/org/apereo/cas/adaptors/duo/web/DuoSecurityPingEndpointTests.java