Skip to content

Commit 26fc091

Browse files
committed
Polish "Use 'unknown' when RabbitMQ version is missing"
See gh-48484
1 parent 4c863c5 commit 26fc091

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ void healthWhenConnectionSucceedsShouldReturnUpWithVersion() {
6767
assertThat(health.getDetails()).containsEntry("version", "123");
6868
}
6969

70-
@Test
71-
void healthWhenConnectionFailsShouldReturnDown() {
72-
givenTemplateExecutionWillInvokeCallback();
73-
given(this.channel.getConnection()).willThrow(new RuntimeException());
74-
Health health = new RabbitHealthIndicator(this.rabbitTemplate).health();
75-
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
76-
}
77-
7870
@Test
7971
void healthWhenVersionIsMissingShouldReturnUpWithUnknownVersion() {
8072
givenTemplateExecutionWillInvokeCallback();
@@ -86,6 +78,14 @@ void healthWhenVersionIsMissingShouldReturnUpWithUnknownVersion() {
8678
assertThat(health.getDetails()).containsEntry("version", "unknown");
8779
}
8880

81+
@Test
82+
void healthWhenConnectionFailsShouldReturnDown() {
83+
givenTemplateExecutionWillInvokeCallback();
84+
given(this.channel.getConnection()).willThrow(new RuntimeException());
85+
Health health = new RabbitHealthIndicator(this.rabbitTemplate).health();
86+
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
87+
}
88+
8989
private void givenTemplateExecutionWillInvokeCallback() {
9090
given(this.rabbitTemplate.execute(any())).willAnswer((invocation) -> {
9191
ChannelCallback<?> callback = invocation.getArgument(0);

0 commit comments

Comments
 (0)