use of io.lettuce.core.RedisConnectionException in project spring-boot by spring-projects.
the class RedisReactiveHealthIndicatorTests method redisConnectionIsDown.
@Test
void redisConnectionIsDown() {
ReactiveRedisConnectionFactory redisConnectionFactory = mock(ReactiveRedisConnectionFactory.class);
given(redisConnectionFactory.getReactiveConnection()).willThrow(new RedisConnectionException("Unable to connect to localhost:6379"));
RedisReactiveHealthIndicator healthIndicator = new RedisReactiveHealthIndicator(redisConnectionFactory);
Mono<Health> health = healthIndicator.health();
StepVerifier.create(health).consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)).verifyComplete();
}
Aggregations