From f941d9979ab9e10da4ac2e2e264c1f13a9b2120c Mon Sep 17 00:00:00 2001 From: John Blum Date: Wed, 19 Sep 2018 10:37:16 -0700 Subject: [PATCH] Add test case testing health check failure when no GemFireCache is present. --- ...ncEventQueuesHealthIndicatorUnitTests.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spring-geode-actuator/src/test/java/org/springframework/geode/boot/actuate/GeodeAsyncEventQueuesHealthIndicatorUnitTests.java b/spring-geode-actuator/src/test/java/org/springframework/geode/boot/actuate/GeodeAsyncEventQueuesHealthIndicatorUnitTests.java index b287ee58..54f9f5be 100644 --- a/spring-geode-actuator/src/test/java/org/springframework/geode/boot/actuate/GeodeAsyncEventQueuesHealthIndicatorUnitTests.java +++ b/spring-geode-actuator/src/test/java/org/springframework/geode/boot/actuate/GeodeAsyncEventQueuesHealthIndicatorUnitTests.java @@ -45,6 +45,10 @@ import org.springframework.data.gemfire.tests.mock.AsyncEventQueueMockObjects; * @see org.mockito.Mock * @see org.mockito.Mockito * @see org.mockito.junit.MockitoJUnitRunner + * @see org.apache.geode.cache.Cache + * @see org.apache.geode.cache.asyncqueue.AsyncEventQueue + * @see org.springframework.boot.actuate.health.Health + * @see org.springframework.geode.boot.actuate.GeodeAsyncEventQueuesHealthIndicator * @since 1.0.0 */ @RunWith(MockitoJUnitRunner.class) @@ -121,4 +125,19 @@ public class GeodeAsyncEventQueuesHealthIndicatorUnitTests { verify(this.mockCache, times(1)).getAsyncEventQueues(); } + + @Test + public void healthCheckFailsWhenNoGemFireCacheIsPresent() throws Exception { + + GeodeAsyncEventQueuesHealthIndicator healthIndicator = new GeodeAsyncEventQueuesHealthIndicator(); + + Health.Builder builder = new Health.Builder(); + + healthIndicator.doHealthCheck(builder); + + Health health = builder.build(); + + assertThat(health).isNotNull(); + assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN); + } }