use of com.hotels.styx.api.configuration.ConfigurationContextResolver in project styx by ExpediaGroup.
the class ConfigurationContextResolverInterceptorTest method resolvesConfigurationContext.
@Test
public void resolvesConfigurationContext() {
LiveHttpRequest request = get("/").build();
Configuration.Context context = context(Map.of("key1", "value1", "key2", "value2"));
ConfigurationContextResolver configurationContextResolver = configurationContextResolver(request, context);
ConfigurationContextResolverInterceptor interceptor = new ConfigurationContextResolverInterceptor(configurationContextResolver);
TestChain chain = new TestChain();
Eventual<LiveHttpResponse> responseObservable = interceptor.intercept(request, chain);
assertThat(Mono.from(responseObservable).block(), hasStatus(OK));
assertThat(chain.proceedWasCalled, is(true));
assertThat(chain.context().get("config.context", Configuration.Context.class), is(context));
}
use of com.hotels.styx.api.configuration.ConfigurationContextResolver in project styx by ExpediaGroup.
the class ConfigurationContextResolverInterceptorTest method configurationContextResolver.
private ConfigurationContextResolver configurationContextResolver(LiveHttpRequest request, Configuration.Context context) {
ConfigurationContextResolver configurationContextResolver = mock(ConfigurationContextResolver.class);
when(configurationContextResolver.resolve(request)).thenReturn(context);
return configurationContextResolver;
}
Aggregations