### Question:
PermissionManager { public GroupsPermissions getPermissionsMapFor(Branch branch) { List<JtalksPermission> branchPermissions = new ArrayList<>(); branchPermissions.addAll(BranchPermission.getAllAsList()); branchPermissions.addAll(pluginPermissionManager.getPluginsBranchPermissions()); return getPermissionsMapFor(branchPermissions, branch); } 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 testGetPermissionsMapForBranch() throws Exception { Branch branch = PersistedObjectsFactory.getDefaultBranch(); givenPermissions(branch, BranchPermission.values()); GroupsPermissions groupsPermissions = manager.getPermissionsMapFor(branch); verify(pluginPermissionManager).getPluginsBranchPermissions(); verify(aclManager).getGroupPermissionsOn(branch); verify(aclUtil, times(BranchPermission.values().length)).getAclFor(branch); assertTrue(groupsPermissions.getPermissions().containsAll(permissions)); for (GroupAce groupAce : groupAces) { List<Group> groups = groupsPermissions.get(groupAce.getPermission(), groupAce.isGranting()); assertNotNull(getGroupWithId(groups, groupAce.getGroupId())); assertTrue(groups.contains(AnonymousGroup.ANONYMOUS_GROUP)); } }