@Test
    void verifySuccessWithCount() throws Throwable {
        val sql = "SELECT count(*) as total FROM CAS_NAMED_USERS where username=:username AND password=:password";
        val properties = new QueryJdbcAuthenticationProperties().setSql(sql);
        properties.setName("namedHandler");
        properties.setPrincipalAttributeList(List.of("phone:phoneNumber"));
        val q = new QueryDatabaseAuthenticationHandler(properties, null, PrincipalFactoryUtils.newPrincipalFactory(), this.dataSource);
        val result = q.authenticate(
            CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword("user0", "psw0"), mock(Service.class));
        assertNotNull(result);
        assertNotNull(result.getPrincipal());
        assertFalse(result.getPrincipal().getAttributes().containsKey("phoneNumber"));
    }
This is tests for {@link QueryDatabaseAuthenticationHandler}.

@author Misagh Moayyed
@since 4.0.0
support/cas-server-support-jdbc-authentication/src/test/java/org/apereo/cas/jdbc/NamedQueryDatabaseAuthenticationHandlerTests.java