@Test
public void testGetPendingMembershipApproverRoles() throws Exception {

    JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
    Mockito.when(mockResultSet.next())
            .thenReturn(true)//domain id lookup for sys.auth.audit.org
            .thenReturn(true)//domain id lookup for sys.auth.audit.domain
            .thenReturn(true)//org org1
            .thenReturn(true)//org1 role id lookup
            .thenReturn(true)//dom1 lookup
            .thenReturn(true)//null org
            .thenReturn(true)//dom1 lookup
            .thenReturn(true)//null org
            .thenReturn(true)//dom1 lookup
            .thenReturn(true)//empty org
            .thenReturn(true)//dom1 lookup
            .thenReturn(false)//org loop ends
            .thenReturn(true)//one self serve role found
            .thenReturn(false);
    Mockito.when(mockResultSet.getInt(1))
            .thenReturn(7) // sys.auth.audit.org domain
            .thenReturn(9) // sys.auth.audit.domain domain
            .thenReturn(11) // org1 role id
            .thenReturn(0); // dom1 - not found
    Mockito.when(mockResultSet.getString(1))
            .thenReturn("org1", null, null, "", "mytestdomain");
    Mockito.when(mockResultSet.getString(2))
            .thenReturn("dom1");
    long timestamp = new Date().getTime();
    java.sql.Timestamp ts = new java.sql.Timestamp(timestamp);
    Set<String> roles = jdbcConn.getPendingMembershipApproverRoles("localhost", timestamp);
    Mockito.verify(mockPrepStmt, times(1)).setInt(1, 7);
    Mockito.verify(mockPrepStmt, times(4)).setInt(1, 9);
    Mockito.verify(mockPrepStmt, times(2)).setTimestamp(1, ts);
    Mockito.verify(mockPrepStmt, times(2)).setString(2, "localhost");
    assertNotNull(roles);
    assertEquals(roles.size(), 2);
    assertTrue(roles.contains("sys.auth.audit.org:role.org1"));
    assertTrue(roles.contains("mytestdomain:role.admin"));
    jdbcConn.close();
}