@Test
public void shouldProcessInterceptorContext() throws Exception {

    final JsonEnvelope inputEnvelope = mock(JsonEnvelope.class);
    final JsonEnvelope outputEnvelope = mock(JsonEnvelope.class);
    final InterceptorContext interceptorContext = interceptorContextWithInput(inputEnvelope);
    final String component = "component";
    when(interceptorCache.getInterceptors(component)).thenReturn(interceptors());
    when(dispatch.apply(inputEnvelope)).thenReturn(outputEnvelope);
    final DefaultInterceptorChainProcessor interceptorChainProcessor = new DefaultInterceptorChainProcessor(interceptorCache, dispatch, component);
    final Optional<JsonEnvelope> result = interceptorChainProcessor.process(interceptorContext);
    assertThat(result.isPresent(), is(true));
    assertThat(result.get(), is(outputEnvelope));
}