WingtipsSpringWebfluxWebFilter implements WebFilter, Ordered { public static Builder newBuilder() { return new Builder(); } WingtipsSpringWebfluxWebFilter();  WingtipsSpringWebfluxWebFilter(Builder builder); static Builder newBuilder(); @Override @NotNull Mono<Void> filter(@NotNull ServerWebExchange exchange, @NotNull WebFilterChain chain); @Override int getOrder(); void setOrder(int order);  }
@Test @SuppressWarnings("unchecked") public void builder_constructor_sets_up_options_as_specified_in_the_builder() { int expectedOrder = 42; HttpTagAndSpanNamingStrategy<ServerWebExchange, ServerHttpResponse> expectedTagStrategyMock = mock(HttpTagAndSpanNamingStrategy.class); HttpTagAndSpanNamingAdapter<ServerWebExchange, ServerHttpResponse> expectedTagAdapterMock = mock(HttpTagAndSpanNamingAdapter.class); List<String> expectedUserIdHeaderKeys = Arrays.asList("foo", "bar"); WingtipsSpringWebfluxWebFilter.Builder builder = WingtipsSpringWebfluxWebFilter .newBuilder() .withOrder(expectedOrder) .withTagAndNamingStrategy(expectedTagStrategyMock) .withTagAndNamingAdapter(expectedTagAdapterMock) .withUserIdHeaderKeys(expectedUserIdHeaderKeys); WingtipsSpringWebfluxWebFilter impl = new WingtipsSpringWebfluxWebFilter(builder); assertThat(impl.order).isEqualTo(expectedOrder); assertThat(impl.tagAndNamingStrategy).isSameAs(expectedTagStrategyMock); assertThat(impl.tagAndNamingAdapter).isSameAs(expectedTagAdapterMock); assertThat(impl.userIdHeaderKeys).isEqualTo(expectedUserIdHeaderKeys); verifyUserIdHeaderKeysIsUnmodifiable(impl); }
@Test public void builder_constructor_sets_up_default_config_options_when_passed_empty_builder() { WingtipsSpringWebfluxWebFilter impl = new WingtipsSpringWebfluxWebFilter( WingtipsSpringWebfluxWebFilter.newBuilder() ); assertThat(impl.order).isEqualTo(Ordered.HIGHEST_PRECEDENCE); assertThat(impl.tagAndNamingStrategy).isSameAs(ZipkinHttpTagStrategy.getDefaultInstance()); assertThat(impl.tagAndNamingAdapter).isSameAs(SpringWebfluxServerRequestTagAdapter.getDefaultInstance()); assertThat(impl.userIdHeaderKeys).isEmpty(); verifyUserIdHeaderKeysIsUnmodifiable(impl); }
@Test public void newBuilder_creates_new_default_builder() { WingtipsSpringWebfluxWebFilter.Builder builder = WingtipsSpringWebfluxWebFilter.newBuilder(); assertThat(builder.order).isNull(); assertThat(builder.tagAndNamingStrategy).isNull(); assertThat(builder.tagAndNamingAdapter).isNull(); assertThat(builder.userIdHeaderKeys).isNull(); }