/**
   * Tests that a user has access to a survey when that user is member of a Group configured on the
   * Survey.
   */
  @Test
  public void testHasAccessInGroup() {
    User user = createUser("user", false);
    Group group = createGroup("group");
    group.getUsers().add(user);
    survey.setPublic(false);
    survey.getGroups().add(group);

    Assert.assertTrue(survey.hasAccess(user));
  }
  @Test
  public void testHasAccessNotInGroup() {
    User user = createUser("user", false);
    Group group = createGroup("group");
    Group nestedGroup = createGroup("nestedGroup");
    nestedGroup.getAdmins().add(user);
    group.getGroups().add(nestedGroup);

    survey.setPublic(false);
    survey.getGroups().add(group);

    User otherUser = createUser("other", false);
    Assert.assertFalse(survey.hasAccess(otherUser));
  }