diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationIntegrationTests.java index d53906dd98..569c6c01db 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationIntegrationTests.java @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.MockClock; +import io.micrometer.core.instrument.Timer; import io.micrometer.core.instrument.binder.MeterBinder; import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; import io.micrometer.core.instrument.binder.logging.LogbackMetrics; @@ -128,9 +129,10 @@ public class MetricsAutoConfigurationIntegrationTests { MockClock.clock(this.registry).addSeconds(2); this.cyclicBarrier.await(); backgroundRequest.join(); - assertThat(this.registry.find("http.server.requests").tags("uri", "/api/async") - .timer()).matches(t -> t.count() == 1) - .matches(t -> t.totalTime(TimeUnit.SECONDS) == 2); + Timer timer = this.registry.get("http.server.requests").tags("uri", "/api/async") + .timer(); + assertThat(timer.count()).isEqualTo(1); + assertThat(timer.totalTime(TimeUnit.SECONDS)).isEqualTo(2); } @Configuration diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizerTests.java index b6ddb9c82a..4eb1baefeb 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizerTests.java @@ -64,9 +64,7 @@ public class MetricsRestTemplateCustomizerTests { @Test public void interceptRestTemplate() { - MockRestServiceServer mockServer = MockRestServiceServer - .createServer(this.restTemplate); - mockServer.expect(MockRestRequestMatchers.requestTo("/test/123")) + this.mockServer.expect(MockRestRequestMatchers.requestTo("/test/123")) .andExpect(MockRestRequestMatchers.method(HttpMethod.GET)) .andRespond(MockRestResponseCreators.withSuccess("OK", MediaType.APPLICATION_JSON)); @@ -79,7 +77,7 @@ public class MetricsRestTemplateCustomizerTests { .tags("method", "GET", "uri", "/test/{id}", "status", "200").timer() .count()).isEqualTo(1); assertThat(result).isEqualTo("OK"); - mockServer.verify(); + this.mockServer.verify(); } @Test