@Test
public void testGetRole() throws Exception {

    Mockito.when(mockResultSet.next()).thenReturn(true);
    Mockito.doReturn("role1").when(mockResultSet).getString(ZMSConsts.DB_COLUMN_NAME);
    Mockito.doReturn("").when(mockResultSet).getString(ZMSConsts.DB_COLUMN_TRUST);
    Mockito.doReturn("ec").when(mockResultSet).getString(ZMSConsts.DB_COLUMN_SIGN_ALGORITHM);
    Mockito.doReturn(true).when(mockResultSet).getBoolean(ZMSConsts.DB_COLUMN_AUDIT_ENABLED);
    Mockito.doReturn(true).when(mockResultSet).getBoolean(ZMSConsts.DB_COLUMN_SELF_SERVE);
    Mockito.doReturn(new java.sql.Timestamp(1454358916)).when(mockResultSet)
            .getTimestamp(ZMSConsts.DB_COLUMN_MODIFIED);
    Mockito.doReturn(new java.sql.Timestamp(1454358917)).when(mockResultSet)
            .getTimestamp(ZMSConsts.DB_COLUMN_LAST_REVIEWED_TIME);
    Mockito.doReturn(true).when(mockResultSet).getBoolean(ZMSConsts.DB_COLUMN_REVIEW_ENABLED);
    Mockito.doReturn("role1,role2").when(mockResultSet).getString(ZMSConsts.DB_COLUMN_NOTIFY_ROLES);
    Mockito.doReturn("").when(mockResultSet).getString(ZMSConsts.DB_COLUMN_USER_AUTHORITY_EXPIRATION);
    Mockito.doReturn("").when(mockResultSet).getString(ZMSConsts.DB_COLUMN_USER_AUTHORITY_FILTER);
    JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
    Role role = jdbcConn.getRole("my-domain", "role1");
    assertNotNull(role);
    assertEquals("my-domain:role.role1", role.getName());
    assertTrue(role.getAuditEnabled());
    assertTrue(role.getSelfServe());
    assertNull(role.getMemberExpiryDays());
    assertNull(role.getServiceExpiryDays());
    assertNull(role.getMemberReviewDays());
    assertNull(role.getServiceReviewDays());
    assertNull(role.getUserAuthorityExpiration());
    assertNull(role.getUserAuthorityFilter());
    assertEquals(role.getSignAlgorithm(), "ec");
    assertEquals(role.getNotifyRoles(), "role1,role2");
    assertTrue(role.getReviewEnabled());
    assertEquals(role.getLastReviewedDate(), Timestamp.fromMillis(1454358917));
    
    Mockito.verify(mockPrepStmt, times(1)).setString(1, "my-domain");
    Mockito.verify(mockPrepStmt, times(1)).setString(2, "role1");
    jdbcConn.close();
}