diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AbstractDelegatingSmartContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/support/AbstractDelegatingSmartContextLoader.java index 9ffccc876e3..8ad57737f6a 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/AbstractDelegatingSmartContextLoader.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/AbstractDelegatingSmartContextLoader.java @@ -151,7 +151,7 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte @Override public void processContextConfiguration(final ContextConfigurationAttributes configAttributes) { Assert.notNull(configAttributes, "configAttributes must not be null"); - Assert.isTrue(!(configAttributes.hasLocations() && configAttributes.hasClasses()), String.format( + Assert.isTrue(!(configAttributes.hasLocations() && configAttributes.hasClasses()), () -> String.format( "Cannot process locations AND classes for context configuration %s: " + "configure one or the other, but not both.", configAttributes)); diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java index 4ca864b953d..376cdaa332c 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java @@ -555,12 +555,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot private static boolean areAllEmpty(Collection... collections) { - for (Collection collection : collections) { - if (!collection.isEmpty()) { - return false; - } - } - return true; + return Arrays.stream(collections).allMatch(Collection::isEmpty); } } diff --git a/spring-test/src/main/java/org/springframework/test/context/support/TestPropertySourceUtils.java b/spring-test/src/main/java/org/springframework/test/context/support/TestPropertySourceUtils.java index c51de9fa18e..ff19e4bbc80 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/TestPropertySourceUtils.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/TestPropertySourceUtils.java @@ -118,7 +118,7 @@ public abstract class TestPropertySourceUtils { } String[] locationsArray = TestContextResourceUtils.convertToClasspathResourcePaths( attrs.getDeclaringClass(), attrs.getLocations()); - locations.addAll(0, Arrays. asList(locationsArray)); + locations.addAll(0, Arrays.asList(locationsArray)); if (!attrs.isInheritLocations()) { break; }