PermissionsManager { public boolean exists(String userId, String domainId, String instanceId, String action) throws ServerException, NotFoundException, ConflictException { return getDomain(domainId).getAllowedActions().contains(action) && getPermissionsDao(domainId).exists(userId, instanceId, action); } @Inject  PermissionsManager(
      EventService eventService, Set<PermissionsDao<? extends AbstractPermissions>> daos); void storePermission(Permissions permissions); AbstractPermissions get(String userId, String domainId, String instanceId); @SuppressWarnings("unchecked") Page<AbstractPermissions> getByInstance(
      String domainId, String instanceId, int maxItems, long skipCount); void remove(String userId, String domainId, String instanceId); boolean exists(String userId, String domainId, String instanceId, String action); void checkActionsSupporting(String domainId, List<String> actions); List<AbstractPermissionsDomain> getDomains(); AbstractPermissionsDomain<? extends AbstractPermissions> getDomain(String domain);  }
@Test public void shouldBeAbleToCheckPermissionExistence() throws Exception { doReturn(true).when(permissionsDao).exists("user", "test123", "use"); assertTrue(permissionsManager.exists("user", "test", "test123", "use")); assertFalse(permissionsManager.exists("user", "test", "test123", "update")); }