Browse Source

Use MergedContextConfiguration.hasResources()

Simplify the code by using MergedContextConfiguration.hasResources().

See gh-49504
pull/49591/head
Sam Brannen 1 week ago committed by Andy Wilkinson
parent
commit
7306fd04de
  1. 4
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java

4
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java

@ -153,9 +153,7 @@ public class SpringBootContextLoader extends AbstractContextLoader implements Ao @@ -153,9 +153,7 @@ public class SpringBootContextLoader extends AbstractContextLoader implements Ao
}
private void assertHasClassesOrLocations(MergedContextConfiguration mergedConfig) {
boolean hasClasses = !ObjectUtils.isEmpty(mergedConfig.getClasses());
boolean hasLocations = !ObjectUtils.isEmpty(mergedConfig.getLocations());
Assert.state(hasClasses || hasLocations,
Assert.state(mergedConfig.hasResources(),
() -> "No configuration classes or locations found in @SpringApplicationConfiguration. "
+ "For default configuration detection to work you need Spring 4.0.3 or better (found "
+ SpringVersion.getVersion() + ").");

Loading…
Cancel
Save