@Test
public void testHandleRequest__OK() throws Exception {

  Request request = createStrictMock(Request.class);
  ResourceInstance resource = createStrictMock(ResourceInstance.class);
  Query query = createMock(Query.class);
  Predicate predicate = createMock(Predicate.class);
  Result result = createStrictMock(Result.class);
  RequestBody body = createStrictMock(RequestBody.class);
  Renderer renderer = new DefaultRenderer();
  Capture<ResultStatus> resultStatusCapture = EasyMock.newCapture();
  Map<String, String> requestInfoProperties = Collections.singletonMap("directive", "value");
  Map<String, TemporalInfo> mapPartialResponseFields = new HashMap<String, TemporalInfo>();
  mapPartialResponseFields.put("foo", null);
  mapPartialResponseFields.put("bar/c", null);
  mapPartialResponseFields.put("bar/d/e", null);
  mapPartialResponseFields.put("category/", null);
  //expectations
  expect(request.getResource()).andReturn(resource);
  expect(resource.getQuery()).andReturn(query);
  expect(request.getPageRequest()).andReturn(null);
  expect(request.getSortRequest()).andReturn(null);
  expect(request.getRenderer()).andReturn(renderer);
  expect(request.getBody()).andReturn(body);
  expect(request.getFields()).andReturn(mapPartialResponseFields);
  expect(body.getRequestInfoProperties()).andReturn(requestInfoProperties);
  query.setRequestInfoProps(requestInfoProperties);
  query.addProperty("foo", null);
  query.addProperty("bar/c", null);
  query.addProperty("bar/d/e", null);
  query.addProperty("category/", null);
  expect(request.getQueryPredicate()).andReturn(predicate);
  query.setUserPredicate(predicate);
  query.setPageRequest(null);
  query.setSortRequest(null);
  query.setRenderer(renderer);
  expect(query.execute()).andReturn(result);
  result.setResultStatus(capture(resultStatusCapture));
  replay(request, resource, body, query, predicate, result);
  //test
  ReadHandler handler = new ReadHandler();
  assertSame(result, handler.handleRequest(request));
  assertEquals(ResultStatus.STATUS.OK, resultStatusCapture.getValue().getStatus());
  verify(request, resource, body, query, predicate, result);
}