diff --git a/spring-core/src/test/java/org/springframework/core/SortedPropertiesTests.java b/spring-core/src/test/java/org/springframework/core/SortedPropertiesTests.java index 8cd96facb6..5b2f13c17c 100644 --- a/spring-core/src/test/java/org/springframework/core/SortedPropertiesTests.java +++ b/spring-core/src/test/java/org/springframework/core/SortedPropertiesTests.java @@ -132,8 +132,11 @@ public class SortedPropertiesTests { String[] lines = lines(baos); - assertThat(lines).containsExactly( // - "", // + assertThat(lines).isNotEmpty(); + // Leniently match first line due to differences between JDK 8 and JDK 9+. + String regex = "<\\?xml .*\\?>"; + assertThat(lines[0]).matches(regex); + assertThat(lines).filteredOn(line -> !line.matches(regex)).containsExactly( // "", // "", // "blue", //