DataPermissionCheckProviderResource extends AbstractDataResource { @POST @Path("permissionCheckGet") public Response getPermissionCheck(PermissionCheckProviderRequest request) { PermissionCheckProviderResult result = getPermissionCheckProvider().isPermitted(request); return responseOkObject(result); } DataPermissionCheckProviderResource(final PermissionCheckProvider permissionCheckProvider); PermissionCheckProvider getPermissionCheckProvider(); @GET Response getHateaos(@Context UriInfo uriInfo); @HEAD @Path("permissionCheckGet") Response status(); @POST // should be a get, but query is too large @Path("permissionCheckGet") Response getPermissionCheck(PermissionCheckProviderRequest request); static URI uriGet(URI baseUri);  }
@Test public void testGet() { PermissionCheckProviderRequest request = PermissionCheckProviderRequest.createGet( ExternalIdBundle.of("A", "B"), "127.0.0.1", "A", "B", "C"); Map<String, Boolean> map = new HashMap<>(); map.put("A", true); map.put("B", true); map.put("C", true); PermissionCheckProviderResult result = PermissionCheckProviderResult.of(map); when(_underlying.isPermitted(same(request))).thenReturn(result); Response test = _resource.getPermissionCheck(request); assertEquals(Status.OK.getStatusCode(), test.getStatus()); assertSame(result, test.getEntity()); }