### Question:
PermissionManager { public JtalksPermission findBranchPermissionByMask(int mask) { JtalksPermission permission = BranchPermission.findByMask(mask); if (permission == null) { permission = pluginPermissionManager.findPluginsBranchPermissionByMask(mask); } return permission; } 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 findPermissionByMaskShouldReturnPluginBranchPermissionIfNoCommonBranchPermissionFound() { int mask = -1; JtalksPermission targetPermission = BranchPermission.CLOSE_TOPICS; when(pluginPermissionManager.findPluginsBranchPermissionByMask(mask)).thenReturn(targetPermission); JtalksPermission result = manager.findBranchPermissionByMask(mask); assertEquals(result, targetPermission); }