PermissionsManager { public AbstractPermissions get(String userId, String domainId, String instanceId) throws ServerException, NotFoundException, ConflictException { return getPermissionsDao(domainId).get(userId, instanceId); } @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 shouldBeAbleToGetPermissionsByUserAndDomainAndInstance() throws Exception { final TestPermissionsImpl permissions = new TestPermissionsImpl("user", "test", "test123", singletonList("read")); when(permissionsDao.get("user", "test123")).thenReturn(permissions); final Permissions fetchedPermissions = permissionsManager.get("user", "test", "test123"); assertEquals(permissions, fetchedPermissions); }