WingtipsSpringWebfluxWebFilter implements WebFilter, Ordered { protected static @Nullable String getRequestAttributeAsString( @NotNull ServerWebExchange exchange, @NotNull String attrName ) { Object attrValue = exchange.getAttribute(attrName); return (attrValue == null) ? null : attrValue.toString(); } 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);  }
@DataProvider(value = { "true", "false" }) @Test public void getRequestAttributeAsString_works_as_expected(boolean attrValueIsNull) { String attrName = UUID.randomUUID().toString(); Object attrValueMock = mock(Object.class); String attrValueToString = UUID.randomUUID().toString(); doReturn(attrValueToString).when(attrValueMock).toString(); if (!attrValueIsNull) { exchange.getAttributes().put(attrName, attrValueMock); } String expectedResult = (attrValueIsNull) ? null : attrValueToString; String result = WingtipsSpringWebfluxWebFilter.getRequestAttributeAsString(exchange, attrName); assertThat(result).isEqualTo(expectedResult); }