@Test
public void testListPrincipalRolesForOneDomain() throws Exception {

    JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
    Mockito.when(mockResultSet.getInt(1))
            .thenReturn(3) // domain id
            .thenReturn(5); //principal id
    // principal roles
    Mockito.when(mockResultSet.next())
            .thenReturn(true) // get domain id
            .thenReturn(true) // get principal id
            .thenReturn(true)
            .thenReturn(true)
            .thenReturn(true)
            .thenReturn(false);
    Mockito.when(mockResultSet.getString(ZMSConsts.DB_COLUMN_ROLE_NAME))
            .thenReturn("admin")
            .thenReturn("reader")
            .thenReturn("writer");
    List<PrincipalRole> roles = jdbcConn.listPrincipalRoles("athenz", "user.joe");
    assertEquals(3, roles.size());
    // get domain id
    Mockito.verify(mockPrepStmt, times(1)).setString(1, "athenz");
    // get principal id
    Mockito.verify(mockPrepStmt, times(1)).setString(1, "user.joe");
    // get role list
    Mockito.verify(mockPrepStmt, times(1)).setInt(1, 5);
    Mockito.verify(mockPrepStmt, times(1)).setInt(2, 3);
    boolean role_admin = false;
    boolean role_reader = false;
    boolean role_writer = false;
    for (PrincipalRole role : roles) {
        switch (role.getRoleName()) {
            case "admin":
                role_admin = true;
                break;
            case "reader":
                role_reader = true;
                break;
            case "writer":
                role_writer = true;
                break;
        }
    }
    assertTrue(role_admin);
    assertTrue(role_reader);
    assertTrue(role_writer);
    jdbcConn.close();
}