@Test
public void testGetPrincipalGroupsException() throws SQLException {

    JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
    Mockito.when(mockResultSet.getInt(1))
            .thenReturn(1);  // Principal id will be 1
    Mockito.when(mockResultSet.next())
            .thenReturn(true) // True for getting principal_id
            .thenThrow(new SQLTimeoutException("failed operation - timeout", "state", 1001));
    try {
        jdbcConn.getPrincipalGroups("johndoe", null);
        fail();
    } catch (ResourceException exception) {
        assertEquals(exception.getCode(), 503);
        assertEquals(exception.getData().toString(), "{code: 503, message: \"Statement cancelled due to timeout\"}");
    }
}