BrowserMobRequestInterceptor implements RequestInterceptor { @Override public void process(final BrowserMobHttpRequest request) { try { WilmaHttpRequest wilmaHttpRequest = httpRequestTransformer.transformRequest(request); wilmaHttpRequestProcessor.processRequest(wilmaHttpRequest); browserMobRequestUpdater.updateRequest(request, wilmaHttpRequest); } catch (ApplicationException e) { logger.error(e.getMessage(), e); } }  @Override void process(final BrowserMobHttpRequest request);  }
@Test public void testProcessShouldLogErrorWhenRequestTransformerThrowsApplicationException() throws ApplicationException { ApplicationException e = new ApplicationException(EMPTY_STRING); given(httpRequestTransformer.transformRequest(bmRequest)).willThrow(e); underTest.process(bmRequest); verify(logger).error(EMPTY_STRING, e); }
@Test public void testProcessShouldLogErrorWhenHandleRequestThrowsApplicationException() throws ApplicationException { ApplicationException e = new ApplicationException(EMPTY_STRING); given(httpRequestTransformer.transformRequest(bmRequest)).willReturn(wilmaRequest); willThrow(e).given(wilmaHttpRequestHandler).processRequest(wilmaRequest); underTest.process(bmRequest); verify(logger).error(EMPTY_STRING, e); }
@Test public void testProcessShouldReturnProperly() throws ApplicationException { given(httpRequestTransformer.transformRequest(bmRequest)).willReturn(wilmaRequest); underTest.process(bmRequest); verify(wilmaHttpRequestHandler).processRequest(wilmaRequest); verify(browserMobRequestUpdater).updateRequest(bmRequest, wilmaRequest); }