private void setUpQuery() throws Exception {
QueryHandlerRegistry qrh =
control.createMock(QueryHandlerRegistry.class);
EasyMock.expect(bus.getExtension(QueryHandlerRegistry.class)).andReturn(qrh).anyTimes();
QueryHandler qh = control.createMock(QueryHandler.class);
List<QueryHandler> handlers = new ArrayList<QueryHandler>();
handlers.add(qh);
EasyMock.expect(qrh.getHandlers()).andReturn(handlers);
String base = ROOT + URI + "?" + QUERY;
EasyMock.expect(qh.isRecognizedQuery(EasyMock.eq(base),
EasyMock.eq(PATH),
EasyMock.same(endpoint))).andReturn(Boolean.TRUE);
EasyMock.expect(qh.getResponseContentType(EasyMock.eq(base),
EasyMock.eq(PATH))).andReturn(XML);
ServletOutputStream sos = control.createMock(ServletOutputStream.class);
EasyMock.expect(response.getOutputStream()).andReturn(sos);
qh.writeResponse(EasyMock.eq(base), EasyMock.eq(PATH), EasyMock.same(endpoint), EasyMock.same(sos));
EasyMock.expectLastCall();
sos.flush();
EasyMock.expectLastCall();
}