@Test
public void testProcess_QueryInURI() throws Exception {
HttpHeaders headers = createNiceMock(HttpHeaders.class);
String uriString = "http://localhost.com:8080/api/v1/clusters/c1?foo=foo-value&bar=bar-value";
URI uri = new URI(URLEncoder.encode(uriString, "UTF-8"));
PredicateCompiler compiler = createStrictMock(PredicateCompiler.class);
Predicate predicate = createNiceMock(Predicate.class);
UriInfo uriInfo = createMock(UriInfo.class);
@SuppressWarnings("unchecked")
MultivaluedMap<String, String> queryParams = createMock(MultivaluedMap.class);
RequestHandler handler = createStrictMock(RequestHandler.class);
Result result = createMock(Result.class);
ResultStatus resultStatus = createMock(ResultStatus.class);
ResultPostProcessor processor = createStrictMock(ResultPostProcessor.class);
RequestBody body = createNiceMock(RequestBody.class);
ResourceInstance resource = createNiceMock(ResourceInstance.class);
ResourceDefinition resourceDefinition = createNiceMock(ResourceDefinition.class);
Renderer renderer = new DefaultRenderer();
Request request = getTestRequest(headers, body, uriInfo, compiler, handler, processor, resource);
//expectations
expect(uriInfo.getQueryParameters()).andReturn(queryParams).anyTimes();
expect(queryParams.getFirst(QueryLexer.QUERY_MINIMAL)).andReturn(null);
expect(queryParams.getFirst(QueryLexer.QUERY_FORMAT)).andReturn(null);
expect(resource.getResourceDefinition()).andReturn(resourceDefinition);
expect(resourceDefinition.getRenderer(null)).andReturn(renderer);
expect(uriInfo.getRequestUri()).andReturn(uri).anyTimes();
expect(body.getQueryString()).andReturn(null);
expect(compiler.compile("foo=foo-value&bar=bar-value")).andReturn(predicate);
expect(handler.handleRequest(request)).andReturn(result);
expect(result.getStatus()).andReturn(resultStatus).anyTimes();
expect(resultStatus.isErrorState()).andReturn(false).anyTimes();
processor.process(result);