### Question:
PermissionManager { private void deleteGrantsOfAnonymousGroup(JtalksPermission permission, Entity entity) { List<Permission> jtalksPermissions = new ArrayList<>(); jtalksPermissions.add(permission); List<Sid> sids = new ArrayList<>(); sids.add(UserSid.createAnonymous()); aclManager.delete(sids, jtalksPermissions, entity); } PermissionManager(@Nonnull AclManager aclManager, @Nonnull GroupDao groupDao,
                             @Nonnull AclUtil aclUtil, @Nonnull PluginPermissionManager pluginPermissionManager); void changeGrants(Entity entity, PermissionChanges changes); void changeRestrictions(Entity entity, PermissionChanges changes); GroupsPermissions getPermissionsMapFor(Branch branch); JtalksPermission findBranchPermissionByMask(int mask); GroupsPermissions getPermissionsMapFor(Component component); GroupsPermissions getPermissionsMapFor(List<Group> groups); GroupsPermissions getPermissionsMapFor(List<JtalksPermission> permissions, Entity entity); List<Group> getAllGroupsWithoutExcluded(List<Group> excludedGroupsList, JtalksPermission permission); List<Group> getGroupsByIds(List<Long> groupIds);  }### Answer:
@Test public void testDeleteGrantsOfAnonymousGroup() throws Exception { Branch branch = ObjectsFactory.getDefaultBranch(); PermissionChanges changes = new PermissionChanges(BranchPermission.CLOSE_TOPICS); changes.addRemovedGroups(Lists.newArrayList(AnonymousGroup.ANONYMOUS_GROUP)); manager.changeGrants(branch, changes); List<Sid> sids = Lists.<Sid>newArrayList(UserSid.createAnonymous()); verify(aclManager, times(changes.getRemovedGroups().size())). delete(eq(sids), eq(listFromArray(changes.getPermission())), eq(branch)); verify(aclManager, times(changes.getNewlyAddedGroupsAsArray().length)). grant(eq(sids), eq(listFromArray(changes.getPermission())), eq(branch)); }