@Test
public void testListRolesWithUserAuthorityRestrictions() throws Exception {

    JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
    // we have 3 entries being returned
    Mockito.when(mockResultSet.next())
            .thenReturn(true)
            .thenReturn(true)
            .thenReturn(true)
            .thenReturn(false);
    Mockito.when(mockResultSet.getString("domain_name"))
            .thenReturn("athenz")
            .thenReturn("athenz.subdomain")
            .thenReturn("sports");
    Mockito.when(mockResultSet.getString("role_name"))
            .thenReturn("admin")
            .thenReturn("readers")
            .thenReturn("readers");
    Mockito.when(mockResultSet.getString("domain_user_authority_filter"))
            .thenReturn("OnShore-US")
            .thenReturn("")
            .thenReturn("");
    List<PrincipalRole> roles = jdbcConn.listRolesWithUserAuthorityRestrictions();
    // data back is sorted
    assertEquals(3, roles.size());
    assertEquals("athenz", roles.get(0).getDomainName());
    assertEquals("admin", roles.get(0).getRoleName());
    assertEquals("OnShore-US", roles.get(0).getDomainUserAuthorityFilter());
    assertEquals("athenz.subdomain", roles.get(1).getDomainName());
    assertEquals("readers", roles.get(1).getRoleName());
    assertTrue(roles.get(1).getDomainUserAuthorityFilter().isEmpty());
    assertEquals("sports", roles.get(2).getDomainName());
    assertEquals("readers", roles.get(2).getRoleName());
    assertTrue(roles.get(2).getDomainUserAuthorityFilter().isEmpty());
    jdbcConn.close();
}