public JsResponse execute(JsRequest jsRequest) throws JsException { JsResponseBuilder resp = new JsResponseBuilder(); jsProcessorRegistry.process(jsRequest, resp); final JsResponse response = resp.build(); if (response.isError()) { throw new JsException(response.getStatusCode(), response.toErrorString()); } return response; } }
@Test public void testProcessorsAreCalledForRequest() throws Exception { IMocksControl control = EasyMock.createControl(); JsRequest request = control.createMock(JsRequest.class); JsProcessorRegistry registry = control.createMock(JsProcessorRegistry.class); DefaultJsServingPipeline pipeline = new DefaultJsServingPipeline(registry); registry.process(EasyMock.eq(request), EasyMock.isA(JsResponseBuilder.class)); control.replay(); pipeline.execute(request); control.verify(); } }
@Test public void testProcessorsAreCalledForRequest() throws Exception { IMocksControl control = EasyMock.createControl(); JsRequest request = control.createMock(JsRequest.class); JsProcessorRegistry registry = control.createMock(JsProcessorRegistry.class); DefaultJsServingPipeline pipeline = new DefaultJsServingPipeline(registry); registry.process(EasyMock.eq(request), EasyMock.isA(JsResponseBuilder.class)); control.replay(); pipeline.execute(request); control.verify(); } }