예제 #1
0
  @Test(expected = IllegalArgumentException.class)
  public void testInvalidArgument() {

    DBUserGroupCallbackImpl callback = new DBUserGroupCallbackImpl(props);
    callback.getGroupsForUser(null, null, null);
    fail("Should fail as it does not have valid configuration");
  }
예제 #2
0
  @Test
  public void testGroupNotExists() {

    DBUserGroupCallbackImpl callback = new DBUserGroupCallbackImpl(props);
    boolean exists = callback.existsGroup("HR");
    assertFalse(exists);
  }
예제 #3
0
  @Test
  public void testUserNotExists() {

    DBUserGroupCallbackImpl callback = new DBUserGroupCallbackImpl(props);
    boolean exists = callback.existsUser("mike");
    assertFalse(exists);
  }
예제 #4
0
  @Test
  public void testGroupExists() {

    DBUserGroupCallbackImpl callback = new DBUserGroupCallbackImpl(props);
    boolean exists = callback.existsGroup("PM");
    assertTrue(exists);
  }
예제 #5
0
  @Test
  public void testUserExists() {

    DBUserGroupCallbackImpl callback = new DBUserGroupCallbackImpl(props);
    boolean exists = callback.existsUser("john");
    assertTrue(exists);
  }
예제 #6
0
  @Test(expected = IllegalArgumentException.class)
  public void testInvalidConfiguration() {

    Properties invalidProps = new Properties();
    DBUserGroupCallbackImpl callback = new DBUserGroupCallbackImpl(invalidProps);
    callback.getGroupsForUser("mike", null, null);
    fail("Should fail as it does not have valid configuration");
  }
예제 #7
0
  @Test
  public void testNoUserGroups() {

    DBUserGroupCallbackImpl callback = new DBUserGroupCallbackImpl(props);
    List<String> groups = callback.getGroupsForUser("mike", null, null);
    assertNotNull(groups);
    assertEquals(0, groups.size());
  }
예제 #8
0
  @Test
  public void testUserGroups() {

    DBUserGroupCallbackImpl callback = new DBUserGroupCallbackImpl(props);
    List<String> groups = callback.getGroupsForUser("john", null, null);
    assertNotNull(groups);
    assertEquals(1, groups.size());
    assertEquals("PM", groups.get(0));
  }