BrowserMobResponseInterceptor implements ResponseInterceptor { @Override public void process(final BrowserMobHttpResponse response) { try { WilmaHttpResponse wilmaResponse = responseTransformer.transformResponse(response); responseProcessor.processResponse(wilmaResponse); browserMobResponseUpdater.updateResponse(response, wilmaResponse); } catch (ApplicationException e) { logger.error(e.getMessage(), e); } }  @Override void process(final BrowserMobHttpResponse response);  }
@Test public void testProcessShouldCallLogger() throws ApplicationException { given(responseTransformer.transformResponse(response)).willReturn(wilmaResponse); underTest.process(response); verify(responseHandler).processResponse(wilmaResponse); verify(browserMobResponseUpdater).updateResponse(response, wilmaResponse); }
@Test public void testProcessWhenApplicationExceptionIsThrownShouldLogError() throws ApplicationException { ApplicationException e = new ApplicationException("exception"); given(responseTransformer.transformResponse(response)).willReturn(wilmaResponse); BDDMockito.willThrow(e).given(responseHandler).processResponse(wilmaResponse); underTest.process(response); verify(logger).error("exception", e); }