@Test
public void testGetRolePrincipals() throws Exception {

    
    JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
    
    Mockito.when(mockResultSet.next())
        .thenReturn(true)
        .thenReturn(true)
        .thenReturn(true)
        .thenReturn(false);
    Mockito.when(mockResultSet.getString(ZMSConsts.DB_COLUMN_NAME))
        .thenReturn("user.user1")
        .thenReturn("user.user2")
        .thenReturn("user.user3");
    Mockito.when(mockResultSet.getString(ZMSConsts.DB_COLUMN_DOMAIN_ID))
        .thenReturn("101")
        .thenReturn("101")
        .thenReturn("102");
    Mockito.when(mockResultSet.getString(ZMSConsts.DB_COLUMN_ROLE_NAME))
        .thenReturn("role1")
        .thenReturn("role1")
        .thenReturn("role3");
    
    Map<String, List<String>> rolePrincipals = jdbcConn.getRolePrincipals(null, false,
            "user", "getRolePrincipals");
    assertEquals(2, rolePrincipals.size());
    
    List<String> principals = rolePrincipals.get("101:role1");
    assertEquals(2, principals.size());
    assertEquals("user.user1", principals.get(0));
    assertEquals("user.user2", principals.get(1));
    
    principals = rolePrincipals.get("102:role3");
    assertEquals(1, principals.size());
    assertEquals("user.user3", principals.get(0));
    
    jdbcConn.close();
}