diff --git a/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorObservabilityTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorObservabilityTests.java index 6132b222e83b..e5ab08b4f0ea 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorObservabilityTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorObservabilityTests.java @@ -175,8 +175,7 @@ private void runScheduledTaskAndAwait() throws InterruptedException { } private TestObservationRegistryAssert.TestObservationRegistryAssertReturningObservationContextAssert assertThatTaskObservation() { - return TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasObservationWithNameEqualTo("tasks.scheduled.execution").that(); + return assertThat(this.observationRegistry).hasObservationWithNameEqualTo("tasks.scheduled.execution").that(); } diff --git a/spring-web/src/test/java/org/springframework/web/client/RestClientObservationTests.java b/spring-web/src/test/java/org/springframework/web/client/RestClientObservationTests.java index 1fe64dab761c..9a438ea866c4 100644 --- a/spring-web/src/test/java/org/springframework/web/client/RestClientObservationTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/RestClientObservationTests.java @@ -190,8 +190,7 @@ void shouldUseCustomConvention() throws Exception { restClient.get().uri("https://example.org").retrieve().toBodilessEntity(); - TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasObservationWithNameEqualTo("custom.requests"); + assertThat(this.observationRegistry).hasObservationWithNameEqualTo("custom.requests"); } @Test @@ -301,9 +300,8 @@ private void mockResponseBody(String expectedBody, MediaType mediaType) throws E private TestObservationRegistryAssert.TestObservationRegistryAssertReturningObservationContextAssert assertThatHttpObservation() { - TestObservationRegistryAssert.assertThat(this.observationRegistry).hasNumberOfObservationsWithNameEqualTo("http.client.requests",1); - return TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasObservationWithNameEqualTo("http.client.requests").that(); + assertThat(this.observationRegistry).hasNumberOfObservationsWithNameEqualTo("http.client.requests",1); + return assertThat(this.observationRegistry).hasObservationWithNameEqualTo("http.client.requests").that(); } static class ContextAssertionObservationHandler implements ObservationHandler { diff --git a/spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java b/spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java index 042477227f4a..9dff87051c17 100644 --- a/spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/RestTemplateObservationTests.java @@ -214,8 +214,7 @@ private void mockResponseBody(String expectedBody, MediaType mediaType) throws E private TestObservationRegistryAssert.TestObservationRegistryAssertReturningObservationContextAssert assertThatHttpObservation() { - return TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasObservationWithNameEqualTo("http.client.requests").that(); + return assertThat(this.observationRegistry).hasObservationWithNameEqualTo("http.client.requests").that(); } static class ContextAssertionObservationHandler implements ObservationHandler { diff --git a/spring-web/src/test/java/org/springframework/web/client/support/RestClientAdapterTests.java b/spring-web/src/test/java/org/springframework/web/client/support/RestClientAdapterTests.java index 23d55703fdd9..2f5e87f985c7 100644 --- a/spring-web/src/test/java/org/springframework/web/client/support/RestClientAdapterTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/support/RestClientAdapterTests.java @@ -27,7 +27,6 @@ import java.util.stream.Stream; import io.micrometer.observation.tck.TestObservationRegistry; -import io.micrometer.observation.tck.TestObservationRegistryAssert; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; @@ -131,9 +130,8 @@ void greeting( assertThat(response).isEqualTo("Hello Spring!"); assertThat(request.getMethod()).isEqualTo("GET"); assertThat(request.getPath()).isEqualTo("/greeting"); - TestObservationRegistryAssert.assertThat(observationRegistry) - .hasObservationWithNameEqualTo("http.client.requests") - .that().hasLowCardinalityKeyValue("uri", "/greeting"); + assertThat(observationRegistry).hasObservationWithNameEqualTo("http.client.requests").that() + .hasLowCardinalityKeyValue("uri", "/greeting"); } @ParameterizedAdapterTest @@ -147,9 +145,8 @@ void greetingById( assertThat(response.getBody()).isEqualTo("Hello Spring!"); assertThat(request.getMethod()).isEqualTo("GET"); assertThat(request.getPath()).isEqualTo("/greeting/456"); - TestObservationRegistryAssert.assertThat(observationRegistry) - .hasObservationWithNameEqualTo("http.client.requests") - .that().hasLowCardinalityKeyValue("uri", "/greeting/{id}"); + assertThat(observationRegistry).hasObservationWithNameEqualTo("http.client.requests").that() + .hasLowCardinalityKeyValue("uri", "/greeting/{id}"); } @ParameterizedAdapterTest @@ -163,9 +160,8 @@ void greetingWithDynamicUri( assertThat(response.orElse("empty")).isEqualTo("Hello Spring!"); assertThat(request.getMethod()).isEqualTo("GET"); assertThat(request.getRequestUrl().uri()).isEqualTo(dynamicUri); - TestObservationRegistryAssert.assertThat(observationRegistry) - .hasObservationWithNameEqualTo("http.client.requests") - .that().hasLowCardinalityKeyValue("uri", "none"); + assertThat(observationRegistry).hasObservationWithNameEqualTo("http.client.requests").that() + .hasLowCardinalityKeyValue("uri", "none"); } @ParameterizedAdapterTest diff --git a/spring-web/src/test/java/org/springframework/web/filter/ServerHttpObservationFilterTests.java b/spring-web/src/test/java/org/springframework/web/filter/ServerHttpObservationFilterTests.java index 090545599779..487727ac83d0 100644 --- a/spring-web/src/test/java/org/springframework/web/filter/ServerHttpObservationFilterTests.java +++ b/spring-web/src/test/java/org/springframework/web/filter/ServerHttpObservationFilterTests.java @@ -187,18 +187,14 @@ void shouldNotCloseObservationDuringAsyncDispatch() throws Exception { this.mockFilterChain = new MockFilterChain(new ScopeCheckingServlet(this.observationRegistry)); this.request.setDispatcherType(DispatcherType.ASYNC); this.filter.doFilter(this.request, this.response, this.mockFilterChain); - TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasObservationWithNameEqualTo("http.server.requests") - .that().isNotStopped(); + assertThat(this.observationRegistry).hasObservationWithNameEqualTo("http.server.requests").that() + .isNotStopped(); } private TestObservationRegistryAssert.TestObservationRegistryAssertReturningObservationContextAssert assertThatHttpObservation() { - TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasNumberOfObservationsWithNameEqualTo("http.server.requests", 1); + assertThat(this.observationRegistry).hasNumberOfObservationsWithNameEqualTo("http.server.requests", 1); - return TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasObservationWithNameEqualTo("http.server.requests") - .that() + return assertThat(this.observationRegistry).hasObservationWithNameEqualTo("http.server.requests").that() .hasBeenStopped(); } diff --git a/spring-web/src/test/java/org/springframework/web/filter/reactive/ServerHttpObservationFilterTests.java b/spring-web/src/test/java/org/springframework/web/filter/reactive/ServerHttpObservationFilterTests.java index fc1d3e75f7ce..89e15eef5e9a 100644 --- a/spring-web/src/test/java/org/springframework/web/filter/reactive/ServerHttpObservationFilterTests.java +++ b/spring-web/src/test/java/org/springframework/web/filter/reactive/ServerHttpObservationFilterTests.java @@ -137,7 +137,6 @@ private WebFilterChain createFilterChain(ThrowingConsumer exc } private TestObservationRegistryAssert.TestObservationRegistryAssertReturningObservationContextAssert assertThatHttpObservation() { - return TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasObservationWithNameEqualTo("http.server.requests").that(); + return assertThat(this.observationRegistry).hasObservationWithNameEqualTo("http.server.requests").that(); } } diff --git a/spring-web/src/test/java/org/springframework/web/server/adapter/HttpWebHandlerAdapterObservabilityTests.java b/spring-web/src/test/java/org/springframework/web/server/adapter/HttpWebHandlerAdapterObservabilityTests.java index 8f83da58f54b..20fdb4328ceb 100644 --- a/spring-web/src/test/java/org/springframework/web/server/adapter/HttpWebHandlerAdapterObservabilityTests.java +++ b/spring-web/src/test/java/org/springframework/web/server/adapter/HttpWebHandlerAdapterObservabilityTests.java @@ -95,8 +95,7 @@ private HttpWebHandlerAdapter createWebHandler(WebHandler targetHandler) { } private TestObservationRegistryAssert.TestObservationRegistryAssertReturningObservationContextAssert assertThatHttpObservation() { - return TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasObservationWithNameEqualTo("http.server.requests").that(); + return assertThat(this.observationRegistry).hasObservationWithNameEqualTo("http.server.requests").that(); } diff --git a/spring-web/src/test/java/org/springframework/web/server/adapter/WebHttpHandlerBuilderTests.java b/spring-web/src/test/java/org/springframework/web/server/adapter/WebHttpHandlerBuilderTests.java index 4d9283b7294b..57e43a558faa 100644 --- a/spring-web/src/test/java/org/springframework/web/server/adapter/WebHttpHandlerBuilderTests.java +++ b/spring-web/src/test/java/org/springframework/web/server/adapter/WebHttpHandlerBuilderTests.java @@ -23,7 +23,6 @@ import java.util.function.Function; import io.micrometer.observation.tck.TestObservationRegistry; -import io.micrometer.observation.tck.TestObservationRegistryAssert; import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -171,8 +170,8 @@ void observationRegistry() { handler.handle(MockServerHttpRequest.get("/").build(), response).block(); TestObservationRegistry observationRegistry = applicationContext.getBean(TestObservationRegistry.class); - TestObservationRegistryAssert.assertThat(observationRegistry).hasObservationWithNameEqualTo("http.server.requests") - .that().hasLowCardinalityKeyValue("uri", "UNKNOWN"); + assertThat(observationRegistry).hasObservationWithNameEqualTo("http.server.requests").that() + .hasLowCardinalityKeyValue("uri", "UNKNOWN"); } @Test diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientObservationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientObservationTests.java index ad662822f53f..1e5699e367ca 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientObservationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientObservationTests.java @@ -183,8 +183,7 @@ void recordsObservationWithResponseDetailsWhenFilterFunctionErrors() { } private TestObservationRegistryAssert.TestObservationRegistryAssertReturningObservationContextAssert assertThatHttpObservation() { - return TestObservationRegistryAssert.assertThat(this.observationRegistry) - .hasObservationWithNameEqualTo("http.client.requests").that(); + return assertThat(this.observationRegistry).hasObservationWithNameEqualTo("http.client.requests").that(); } private ClientRequest verifyAndGetRequest() {