@Test public void getPrimaryGroupKeylessWithUnknownIDReturnsBlank() throws MalformedURLException, InstantiationException, IllegalAccessException, SQLException { configuration.webappPrimaryGroupUsesKey = false; when(sql.sqlQuery(anyString())).thenReturn(result); assertEquals("", webGroupDao.getPrimaryGroupID(user_id1)); }
@Test public void getPrimaryGroupKeyedWithValidIDReturnsGroup() throws MalformedURLException, InstantiationException, IllegalAccessException, SQLException { when(sql.sqlQuery(anyString())).thenReturn(result); when(result.next()).thenReturn(Boolean.TRUE); when(result.getString(configuration.webappPrimaryGroupGroupIDColumn)).thenReturn(group1); assertEquals(group1, webGroupDao.getPrimaryGroupID(user_id1)); }
@Test public void getPrimaryGroupWithPrimaryDisabledReturnsBlank() throws IllegalAccessException, InstantiationException, MalformedURLException, SQLException { configuration.webappPrimaryGroupEnabled = false; assertEquals("", webGroupDao.getPrimaryGroupID(user_id1)); }
@Test public void getPrimaryGroupNeverReturnsNull() throws IllegalAccessException, SQLException, MalformedURLException, InstantiationException { configuration.webappPrimaryGroupEnabled = false; assertNotNull(webGroupDao.getPrimaryGroupID("")); }