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 8cd96facb6b8ed084e6cd5a04719883d824e91e9..5b2f13c17c49e723300eeba9738a3ddc6deb92b1 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", //