@Test public void removeGroupUsesCorrectReadQuery() throws MalformedURLException, InstantiationException, IllegalAccessException, SQLException { String query = getRemoveGroupReadQuery(); when(sql.sqlQuery(query)).thenReturn(result); when(result.next()).thenReturn(false); webGroupDao.removeUserFromGroup(USER_ID, GROUP_ID); verify(sql).sqlQuery(query); }
private void testRemoveGroupUpdateQuery(String before, String after) throws SQLException, IllegalAccessException, MalformedURLException, InstantiationException { when(sql.sqlQuery(getRemoveGroupReadQuery())).thenReturn(result); when(result.next()).thenReturn(true); when(result.getString(configuration.webappSecondaryGroupGroupIDColumn)).thenReturn(before); String query = getRemoveGroupUpdateQuery(after); doNothing().when(sql).updateQuery(query); webGroupDao.removeUserFromGroup(USER_ID, group1); verify(sql).updateQuery(query); }