From d60d59434d53bdde52943c0b7c2a82c24fa29ddb Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 8 Oct 2019 13:20:59 +0900 Subject: [PATCH] Polish See gh-18531 --- ...ibutorRegistryHealthIndicatorRegistryAdapterTests.java | 4 ++-- .../HealthIndicatorRegistryInjectionIntegrationTests.java | 8 +------- ...gistryReactiveHealthIndicatorRegistryAdapterTests.java | 4 ++-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorRegistryHealthIndicatorRegistryAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorRegistryHealthIndicatorRegistryAdapterTests.java index e815ccfc81..9f93c23115 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorRegistryHealthIndicatorRegistryAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorRegistryHealthIndicatorRegistryAdapterTests.java @@ -57,7 +57,7 @@ class HealthContributorRegistryHealthIndicatorRegistryAdapterTests { } @Test - void unregisterWhenDelegatesToContributorRegistry() { + void unregisterDelegatesToContributorRegistry() { HealthIndicator healthIndicator = mock(HealthIndicator.class); this.contributorRegistry.registerContributor("test", healthIndicator); HealthIndicator unregistered = this.adapter.unregister("test"); @@ -89,7 +89,7 @@ class HealthContributorRegistryHealthIndicatorRegistryAdapterTests { } @Test - void getAllDelegatesContributorRegistry() { + void getAllDelegatesToContributorRegistry() { HealthIndicator healthIndicator = mock(HealthIndicator.class); this.contributorRegistry.registerContributor("test", healthIndicator); Map all = this.adapter.getAll(); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorRegistryInjectionIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorRegistryInjectionIntegrationTests.java index 3d7469c50b..1b8d8f77c8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorRegistryInjectionIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorRegistryInjectionIntegrationTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.actuate.autoconfigure.health; -import java.util.List; - import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.MeterRegistry; import org.junit.jupiter.api.Test; @@ -27,7 +25,6 @@ import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegi import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; import org.springframework.boot.actuate.health.CompositeHealthIndicator; import org.springframework.boot.actuate.health.HealthAggregator; -import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.actuate.health.HealthIndicatorRegistry; import org.springframework.boot.actuate.health.Status; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; @@ -61,12 +58,9 @@ public class HealthIndicatorRegistryInjectionIntegrationTests { static class Config { Config(HealthAggregator healthAggregator, HealthIndicatorRegistry healthIndicatorRegistry, - List healthIndicators, MeterRegistry registry) { + MeterRegistry registry) { CompositeHealthIndicator healthIndicator = new CompositeHealthIndicator(healthAggregator, healthIndicatorRegistry); - for (int i = 0; i < healthIndicators.size(); i++) { - healthIndicatorRegistry.register(Integer.toString(i), healthIndicators.get(i)); - } Gauge.builder("health", healthIndicator, this::getGuageValue) .description("Spring boot health indicator. 3=UP, 2=OUT_OF_SERVICE, 1=DOWN, 0=UNKNOWN") .strongReference(true).register(registry); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapterTests.java index 3d125ca0d0..ef89e9b24a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapterTests.java @@ -58,7 +58,7 @@ class ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapterTes } @Test - void unregisterWhenDelegatesToContributorRegistry() { + void unregisterDelegatesToContributorRegistry() { ReactiveHealthIndicator healthIndicator = mock(ReactiveHealthIndicator.class); this.contributorRegistry.registerContributor("test", healthIndicator); ReactiveHealthIndicator unregistered = this.adapter.unregister("test"); @@ -90,7 +90,7 @@ class ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapterTes } @Test - void getAllDelegatesContributorRegistry() { + void getAllDelegatesToContributorRegistry() { ReactiveHealthIndicator healthIndicator = mock(ReactiveHealthIndicator.class); this.contributorRegistry.registerContributor("test", healthIndicator); Map all = this.adapter.getAll();