@Test
public void testHandleRequest__InvalidQueryException() throws Exception {
Request request = createStrictMock(Request.class);
ResourceInstance resource = createStrictMock(ResourceInstance.class);
Query query = createMock(Query.class);
InvalidQueryException exception = new InvalidQueryException("test");
expect(request.getResource()).andReturn(resource);
expect(resource.getQuery()).andReturn(query);
expect(request.getFields()).andReturn(Collections.<String, TemporalInfo>emptyMap());
expect(request.getQueryPredicate()).andThrow(exception);
replay(request, resource, query);
//test
QueryCreateHandler handler = new QueryCreateHandler();
Result result = handler.handleRequest(request);
assertEquals(ResultStatus.STATUS.BAD_REQUEST, result.getStatus().getStatus());
assertTrue(result.getStatus().getMessage().contains(exception.getMessage()));
verify(request, resource, query);
}