コード例 #1
0
 @Test
 public void getPrimaryGroupUserIDsWhenNoMembersReturnsEmptyList()
     throws IllegalAccessException, InstantiationException, MalformedURLException, SQLException {
   when(sql.sqlQuery(anyString())).thenReturn(result);
   when(result.next()).thenReturn(false);
   assertEquals(0, webGroupDao.getUserIDsFromPrimaryGroup(group1).size());
 }
コード例 #2
0
 @Test
 public void getPrimaryGroupUserIDsReturnsUserID()
     throws IllegalAccessException, InstantiationException, MalformedURLException, SQLException {
   when(sql.sqlQuery(anyString())).thenReturn(result);
   when(result.next()).thenReturn(true, false);
   when(result.getString(configuration.webappPrimaryGroupUserIDColumn)).thenReturn(user_id1);
   List<String> groupMembers = webGroupDao.getUserIDsFromPrimaryGroup(group1);
   assertEquals(1, groupMembers.size());
   assertEquals(user_id1, groupMembers.get(0));
 }
コード例 #3
0
  @Test
  public void getPrimaryGroupUserIDsWithMultipleUserIDsReturnUserIDs()
      throws IllegalAccessException, InstantiationException, MalformedURLException, SQLException {
    String userID2 = RandomStringUtils.randomNumeric(2);
    when(sql.sqlQuery(anyString())).thenReturn(result);
    when(result.next()).thenReturn(true, true, false);
    when(result.getString(configuration.webappPrimaryGroupUserIDColumn))
        .thenReturn(user_id1, userID2);

    List<String> groupMembers = webGroupDao.getUserIDsFromPrimaryGroup(group1);
    assertEquals(2, groupMembers.size());
    assertEquals(user_id1, groupMembers.get(0));
    assertEquals(userID2, groupMembers.get(1));
  }
コード例 #4
0
 @Test
 public void getPrimaryGroupUserIDsWhenPrimaryDisabledReturnsEmptyList()
     throws IllegalAccessException, InstantiationException, MalformedURLException, SQLException {
   configuration.webappPrimaryGroupEnabled = false;
   assertEquals(0, webGroupDao.getUserIDsFromPrimaryGroup(group1).size());
 }
コード例 #5
0
 @Test
 public void getPrimaryGroupUserIDsNeverReturnNull()
     throws IllegalAccessException, InstantiationException, MalformedURLException, SQLException {
   configuration.webappPrimaryGroupEnabled = false;
   assertNotNull(webGroupDao.getUserIDsFromPrimaryGroup(group1));
 }