When testing configurations, it can be difficult to verify how WebClient, RestClient, and RestTemplate have been configured.

I’d like to suggest adding assertion (assertThat) support for these objects to simplify validation in tests.

Example Code:

@Test
void testWebClient() {
  new ApplicationContextRunner()
      .withConfiguration(AutoConfigurations.of(WebClientAutoConfiguration.class))
      .withUserConfiguration(MyConfig.class)
      .run(context -> {
        assertThat(context).hasNotFailed();
        WebClient.Builder builder = context.getBean(WebClient.Builder.class);
        assertThat(builder)  // or WebClient itself
            .hasBaseUrlSatisfying((baseUrl) -> assertThat(baseUrl).isEqualTo("http://localhost:8080"))
            .hasFiltersSatisfying((filters) -> assertThat(filters).hasSize(1).first().isInstanceOf(MyExchangeFilterFunction.class))
            .hasNettyHttpClientSatisfying((httpClient) ->
              assertThat(httpClient)
                  .keepAliveEnabled()
                  .hasResponseTime((duration) -> assertThat(duration).hasSeconds(5)));
      });
}

@Configuration
static class MyConfig {

  @Bean
  WebClientCustomizer myCustomizer() {
    return (builder) ->
        builder.filter(new MyExchangeFilterFunction()).baseUrl("http://localhost:8080");
  }

  @Bean
  ReactorNettyHttpClientMapper myReactorNettyHttpClientMapper() {
    return (httpClient) -> httpClient
        .keepAlive(true)
        .responseTimeout(Duration.ofSeconds(5));
  }
}