DefaultInterceptorContext implements InterceptorContext { @Override public String getComponentName() { return (String) getInputParameter("component").orElse(UNKNOWN_COMPONENT); } DefaultInterceptorContext(final ContextPayload input, final ContextPayload output); InterceptorContext copyWithInput(final JsonEnvelope inputEnvelope); InterceptorContext copyWithOutput(final JsonEnvelope outputEnvelope); JsonEnvelope inputEnvelope(); Optional<JsonEnvelope> outputEnvelope(); Optional<Object> getInputParameter(final String name); void setInputParameter(final String name, final Object parameter); Optional<Object> getOutputParameter(final String name); void setOutputParameter(final String name, final Object parameter); ContextPayload inputContext(); ContextPayload outputContext(); @Override String getComponentName();  }
@Test public void shouldGetDefaultUnknownComponentNameIfNotSet() { final InterceptorContext interceptorContext = interceptorContextWithInput(input); assertThat(interceptorContext.getComponentName(), is("UNKNOWN")); }