@Test
public void testHandleRequest__NoSuchParentResourceException() throws Exception {

  Request request = createStrictMock(Request.class);
  ResourceInstance resource = createStrictMock(ResourceInstance.class);
  Query query = createMock(Query.class);
  Predicate predicate = createMock(Predicate.class);
  NoSuchParentResourceException exception = new NoSuchParentResourceException("exceptionMsg", new RuntimeException());
  Renderer renderer = new DefaultRenderer();
  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(null);
  expect(request.getFields()).andReturn(Collections.<String, TemporalInfo>emptyMap());
  expect(request.getQueryPredicate()).andReturn(predicate);
  query.setUserPredicate(predicate);
  query.setPageRequest(null);
  query.setSortRequest(null);
  query.setRenderer(renderer);
  expect(query.execute()).andThrow(exception);
  replay(request, resource, query, predicate);
  //test
  ReadHandler handler = new ReadHandler();
  Result result = handler.handleRequest(request);
  assertEquals(ResultStatus.STATUS.NOT_FOUND, result.getStatus().getStatus());
  assertEquals("exceptionMsg", result.getStatus().getMessage());
  verify(request, resource, query, predicate);
}