use of com.datastax.oss.driver.api.core.DriverTimeoutException in project spring-boot by spring-projects.
the class CassandraDriverReactiveHealthIndicatorTests method healthWithCassandraDownShouldReturnDown.
@Test
void healthWithCassandraDownShouldReturnDown() {
CqlSession session = mock(CqlSession.class);
given(session.getMetadata()).willThrow(new DriverTimeoutException("Test Exception"));
CassandraDriverReactiveHealthIndicator cassandraReactiveHealthIndicator = new CassandraDriverReactiveHealthIndicator(session);
Mono<Health> health = cassandraReactiveHealthIndicator.health();
StepVerifier.create(health).consumeNextWith((h) -> {
assertThat(h.getStatus()).isEqualTo(Status.DOWN);
assertThat(h.getDetails()).containsOnlyKeys("error");
assertThat(h.getDetails().get("error")).isEqualTo(DriverTimeoutException.class.getName() + ": Test Exception");
}).verifyComplete();
}
use of com.datastax.oss.driver.api.core.DriverTimeoutException in project spring-boot by spring-projects.
the class CassandraDriverHealthIndicatorTests method healthWithcassandraDownShouldReturnDown.
@Test
void healthWithcassandraDownShouldReturnDown() {
CqlSession session = mock(CqlSession.class);
given(session.getMetadata()).willThrow(new DriverTimeoutException("Test Exception"));
CassandraDriverHealthIndicator healthIndicator = new CassandraDriverHealthIndicator(session);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
assertThat(health.getDetails().get("error")).isEqualTo(DriverTimeoutException.class.getName() + ": Test Exception");
}
Aggregations