@Test(expected = MembershipPolicyException.class) public void testAssignUsersToForbiddenGroup() throws Exception { long[] forbiddenGroupIds = addForbiddenGroups(); UserServiceUtil.addGroupUsers( forbiddenGroupIds[0], addUsers(), ServiceContextTestUtil.getServiceContext()); }
@Test public void testPropagateWhenAssigningUsersToRequiredGroup() throws Exception { long[] requiredGroupIds = addRequiredGroups(); UserServiceUtil.addGroupUsers( requiredGroupIds[0], addUsers(), ServiceContextTestUtil.getServiceContext()); Assert.assertTrue(isPropagateMembership()); }
@Test public void testAssignUsersToRequiredGroup() throws Exception { long[] requiredGroupIds = addRequiredGroups(); int initialGroupUsersCount = UserLocalServiceUtil.getGroupUsersCount(requiredGroupIds[0]); UserServiceUtil.addGroupUsers( requiredGroupIds[0], addUsers(), ServiceContextTestUtil.getServiceContext()); Assert.assertEquals( initialGroupUsersCount + 2, UserLocalServiceUtil.getGroupUsersCount(requiredGroupIds[0])); Assert.assertTrue(isPropagateMembership()); }