@Test
    void verifyOkAccountFromExternalFile() throws Throwable {
        val resource = new ClassPathResource("sample-users.json");
        val jsonHandler = new JsonResourceAuthenticationHandler(null, mock(ServicesManager.class),
            PrincipalFactoryUtils.newPrincipalFactory(), null, resource);
        assertThrows(FailedLoginException.class,
            () -> jsonHandler.authenticate(CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword("casuser", "bad-password"), mock(Service.class)));
        val result = jsonHandler.authenticate(CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword("casuser", "Mellon"), mock(Service.class));
        assertNotNull(result);
        assertEquals(1, result.getWarnings().size());
        assertEquals("casuser", result.getPrincipal().getId());
        assertFalse(result.getPrincipal().getAttributes().isEmpty());
        assertTrue(result.getPrincipal().getAttributes().containsKey("firstName"));
        assertEquals("Apereo", result.getPrincipal().getAttributes().get("firstName").getFirst());
    }
This is {@link JsonResourceAuthenticationHandlerTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-generic/src/test/java/org/apereo/cas/adaptors/generic/JsonResourceAuthenticationHandlerTests.java