diff --git a/spring-context/src/test/java/org/springframework/format/datetime/DateFormattingTests.java b/spring-context/src/test/java/org/springframework/format/datetime/DateFormattingTests.java index 15342c69b6..df7729181f 100644 --- a/spring-context/src/test/java/org/springframework/format/datetime/DateFormattingTests.java +++ b/spring-context/src/test/java/org/springframework/format/datetime/DateFormattingTests.java @@ -140,10 +140,14 @@ public class DateFormattingTests { .hasCauseInstanceOf(ParseException.class).getCause() // Unable to parse date time value "99/01/01" using configuration from // @org.springframework.format.annotation.DateTimeFormat(pattern=, style=S-, iso=NONE, fallbackPatterns=[]) + // We do not check "fallbackPatterns=[]", since the array representation in the toString() + // implementation for annotations changed from [] to {} in Java 9. In addition, strings + // are enclosed in double quotes beginning with Java 9. Thus, we cannot check directly + // for the presence of "style=S-". .hasMessageContainingAll( "Unable to parse date time value \"99/01/01\" using configuration from", "@org.springframework.format.annotation.DateTimeFormat", - "style=S-", "iso=NONE", "fallbackPatterns=[]") + "style=", "S-", "iso=NONE") .hasCauseInstanceOf(ParseException.class).getCause() .hasMessageStartingWith("Unparseable date: \"99/01/01\"") .hasNoCause(); diff --git a/spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java b/spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java index 6aa28756f6..23a62770fd 100644 --- a/spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java +++ b/spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java @@ -339,10 +339,11 @@ class DateTimeFormattingTests { .hasCauseInstanceOf(DateTimeParseException.class).getCause() // Unable to parse date time value "2009-31-10" using configuration from // @org.springframework.format.annotation.DateTimeFormat(pattern=, style=SS, iso=DATE, fallbackPatterns=[]) + // We do not check "fallbackPatterns=[]", since the array representation in the toString() + // implementation for annotations changed from [] to {} in Java 9. .hasMessageContainingAll( "Unable to parse date time value \"2009-31-10\" using configuration from", - "@org.springframework.format.annotation.DateTimeFormat", - "iso=DATE", "fallbackPatterns=[]") + "@org.springframework.format.annotation.DateTimeFormat", "iso=DATE") .hasCauseInstanceOf(DateTimeParseException.class).getCause() .hasMessageStartingWith("Text '2009-31-10'") .hasCauseInstanceOf(DateTimeException.class).getCause()