@Test
public void createPaginatedResponseTestFiltered() {

    // Setup
    Set<Thing> set = getTestThings(Collections.singletonMap(testPropIRI, "VALUE"));
    Function<Thing, Boolean> f;
    f = new Function<Thing, Boolean>() {
        @Override
        public Boolean apply(Thing t) {
            return !t.getProperties(testPropIRI).contains(vf.createLiteral("VALUE 2"));
        }
    };
    Response response = RestUtils.createPaginatedThingResponse(uriInfo, set, testPropIRI, 0, 1, true,
            f, "http://example.com/test#TestThing", transformer, service);
    Object object = response.getEntity();
    assertTrue(object instanceof JSONArray);
    JSONArray array = (JSONArray) object;
    assertTrue(array.get(0) instanceof JSONObject);
    JSONObject jsonObject = (JSONObject) array.get(0);
    assertEquals(jsonObject.getJSONArray(testPropIRI.stringValue()).getJSONObject(0).getString("@value"), "VALUE 1");
    assertEquals(response.getLinks().size(), 1);
    Link link = response.getLinks().iterator().next();
    assertEquals(link.getRel(), "next");
    assertTrue(link.getUri().getRawPath().equals("/rest/tests"));
    response = RestUtils.createPaginatedThingResponse(uriInfo, set, testPropIRI, 1, 1, true,
            f, "http://example.com/test#TestThing", transformer, service);
    object = response.getEntity();
    assertTrue(object instanceof JSONArray);
    array = (JSONArray) object;
    assertTrue(array.get(0) instanceof JSONObject);
    jsonObject = (JSONObject) array.get(0);
    assertEquals(jsonObject.getJSONArray(testPropIRI.stringValue()).getJSONObject(0).getString("@value"), "VALUE 3");
    assertEquals(response.getLinks().size(), 1);
    link = response.getLinks().iterator().next();
    assertEquals(link.getRel(), "prev");
    assertTrue(link.getUri().getRawPath().equals("/rest/tests"));
}