Browse Source

Fix SortedPropertiesTests on JDK 9+

pull/23061/head
Sam Brannen 6 years ago
parent
commit
f66eef1f88
  1. 7
      spring-core/src/test/java/org/springframework/core/SortedPropertiesTests.java

7
spring-core/src/test/java/org/springframework/core/SortedPropertiesTests.java

@ -132,8 +132,11 @@ public class SortedPropertiesTests { @@ -132,8 +132,11 @@ public class SortedPropertiesTests {
String[] lines = lines(baos);
assertThat(lines).containsExactly( //
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>", //
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( //
"<!DOCTYPE properties SYSTEM \"http://java.sun.com/dtd/properties.dtd\">", //
"<properties>", //
"<entry key=\"color\">blue</entry>", //

Loading…
Cancel
Save