@Test
public void testListPolicies() throws Exception {

    
    JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
    Mockito.doReturn(5).when(mockResultSet).getInt(1); // return domain id
    
    Mockito.when(mockResultSet.next())
        .thenReturn(true) // this one is for domain id
        .thenReturn(true)
        .thenReturn(true)
        .thenReturn(true)
        .thenReturn(false);
    Mockito.when(mockResultSet.getString(1))
        .thenReturn("zpolicy")
        .thenReturn("apolicy")
        .thenReturn("bpolicy");
    
    List<String> policies = jdbcConn.listPolicies("my-domain", null);
    
    // data back is sorted
    
    assertEquals(3, policies.size());
    assertEquals("apolicy", policies.get(0));
    assertEquals("bpolicy", policies.get(1));
    assertEquals("zpolicy", policies.get(2));
    jdbcConn.close();
}