From f66eef1f88fa78e76a18161489ad2411cdf4c258 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 30 May 2019 10:41:49 +0200 Subject: [PATCH] Fix SortedPropertiesTests on JDK 9+ --- .../org/springframework/core/SortedPropertiesTests.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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", //