|
|
|
|
@ -16,6 +16,8 @@
@@ -16,6 +16,8 @@
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.autoconfigure.condition; |
|
|
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
import org.springframework.boot.test.context.assertj.AssertableApplicationContext; |
|
|
|
|
@ -68,6 +70,20 @@ public class ConditionalOnClassTests {
@@ -68,6 +70,20 @@ public class ConditionalOnClassTests {
|
|
|
|
|
.run(this::hasBarBean); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void onClassConditionOutputShouldNotContainConditionalOnMissingClassInMessage() { |
|
|
|
|
this.contextRunner.withUserConfiguration(BasicConfiguration.class) |
|
|
|
|
.run((context) -> { |
|
|
|
|
Collection<ConditionEvaluationReport.ConditionAndOutcomes> conditionAndOutcomes = ConditionEvaluationReport |
|
|
|
|
.get(context.getSourceApplicationContext().getBeanFactory()) |
|
|
|
|
.getConditionAndOutcomesBySource().values(); |
|
|
|
|
String message = conditionAndOutcomes.iterator().next().iterator() |
|
|
|
|
.next().getOutcome().getMessage(); |
|
|
|
|
assertThat(message).doesNotContain( |
|
|
|
|
"@ConditionalOnMissingClass did not find unwanted class"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void hasBarBean(AssertableApplicationContext context) { |
|
|
|
|
assertThat(context).hasBean("bar"); |
|
|
|
|
assertThat(context.getBean("bar")).isEqualTo("bar"); |
|
|
|
|
|