Browse Source

Polish "Use 'unknown' when RabbitMQ version is missing"

See gh-48484
3.4.x
Stéphane Nicoll 2 weeks ago
parent
commit
26fc091c50
  1. 16
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/amqp/RabbitHealthIndicatorTests.java

16
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/amqp/RabbitHealthIndicatorTests.java

@ -67,14 +67,6 @@ class RabbitHealthIndicatorTests { @@ -67,14 +67,6 @@ class RabbitHealthIndicatorTests {
assertThat(health.getDetails()).containsEntry("version", "123");
}
@Test
void healthWhenConnectionFailsShouldReturnDown() {
givenTemplateExecutionWillInvokeCallback();
given(this.channel.getConnection()).willThrow(new RuntimeException());
Health health = new RabbitHealthIndicator(this.rabbitTemplate).health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
}
@Test
void healthWhenVersionIsMissingShouldReturnUpWithUnknownVersion() {
givenTemplateExecutionWillInvokeCallback();
@ -86,6 +78,14 @@ class RabbitHealthIndicatorTests { @@ -86,6 +78,14 @@ class RabbitHealthIndicatorTests {
assertThat(health.getDetails()).containsEntry("version", "unknown");
}
@Test
void healthWhenConnectionFailsShouldReturnDown() {
givenTemplateExecutionWillInvokeCallback();
given(this.channel.getConnection()).willThrow(new RuntimeException());
Health health = new RabbitHealthIndicator(this.rabbitTemplate).health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
}
private void givenTemplateExecutionWillInvokeCallback() {
given(this.rabbitTemplate.execute(any())).willAnswer((invocation) -> {
ChannelCallback<?> callback = invocation.getArgument(0);

Loading…
Cancel
Save