File tree Expand file tree Collapse file tree 4 files changed +23
-13
lines changed
spring-boot-project/spring-boot-health
main/java/org/springframework/boot/health
test/java/org/springframework/boot/health Expand file tree Collapse file tree 4 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,6 @@ dependencies {
1616 testImplementation(project(" :spring-boot-project:spring-boot-tools:spring-boot-test-support" ))
1717 testImplementation(" com.fasterxml.jackson.core:jackson-databind" )
1818 testImplementation(" io.projectreactor:reactor-test" )
19+
20+ testRuntimeOnly(" ch.qos.logback:logback-classic" )
1921}
Original file line number Diff line number Diff line change @@ -35,10 +35,7 @@ static ReactiveHealthContributor adapt(HealthContributor healthContributor) {
3535 if (healthContributor instanceof HealthIndicator healthIndicator ) {
3636 return new HealthIndicatorReactiveAdapter (healthIndicator );
3737 }
38- if (healthContributor instanceof CompositeHealthContributor compositeHealthContributor ) {
39- return new CompositeHealthContributorReactiveAdapter (compositeHealthContributor );
40- }
41- throw new IllegalStateException ("Unknown HealthContributor type" );
38+ return new CompositeHealthContributorReactiveAdapter ((CompositeHealthContributor ) healthContributor );
4239 }
4340
4441}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2012-2025 the original author or authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ /**
18+ * Classes related to monitoring the health of an application.
19+ */
20+ package org .springframework .boot .health ;
Original file line number Diff line number Diff line change 2222
2323import static org .assertj .core .api .Assertions .assertThat ;
2424import static org .assertj .core .api .Assertions .assertThatIllegalArgumentException ;
25- import static org .assertj .core .api .Assertions .assertThatIllegalStateException ;
26- import static org .mockito .Mockito .mock ;
2725
2826/**
2927 * Tests for {@link ReactiveHealthContributor}.
@@ -57,11 +55,4 @@ void adaptWhenCompositeHealthContributorReturnsCompositeHealthContributorReactiv
5755 assertThat (((ReactiveHealthIndicator ) contained ).health ().block ().getStatus ()).isEqualTo (Status .OUT_OF_SERVICE );
5856 }
5957
60- @ Test
61- void adaptWhenUnknownThrowsException () {
62- assertThatIllegalStateException ()
63- .isThrownBy (() -> ReactiveHealthContributor .adapt (mock (HealthContributor .class )))
64- .withMessage ("Unknown HealthContributor type" );
65- }
66-
6758}
You can’t perform that action at this time.
0 commit comments