Skip to content

Commit 279f964

Browse files
committed
Merge branch '5.3.x'
2 parents ee209de + aa8802a commit 279f964

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

spring-context/src/test/java/org/springframework/format/datetime/DateFormattingTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -132,11 +132,11 @@ void styleDateWithInvalidFormat() {
132132
TypeMismatchException exception = fieldError.unwrap(TypeMismatchException.class);
133133
assertThat(exception)
134134
.hasMessageContaining("for property 'styleDate'")
135-
.hasCauseInstanceOf(ConversionFailedException.class).getCause()
135+
.hasCauseInstanceOf(ConversionFailedException.class).cause()
136136
.hasMessageContaining("for value '99/01/01'")
137-
.hasCauseInstanceOf(IllegalArgumentException.class).getCause()
137+
.hasCauseInstanceOf(IllegalArgumentException.class).cause()
138138
.hasMessageContaining("Parse attempt failed for value [99/01/01]")
139-
.hasCauseInstanceOf(ParseException.class).getCause()
139+
.hasCauseInstanceOf(ParseException.class).cause()
140140
// Unable to parse date time value "99/01/01" using configuration from
141141
// @org.springframework.format.annotation.DateTimeFormat(pattern=, style=S-, iso=NONE, fallbackPatterns=[])
142142
// We do not check "fallbackPatterns=[]", since the array representation in the toString()
@@ -147,7 +147,7 @@ void styleDateWithInvalidFormat() {
147147
"Unable to parse date time value \"99/01/01\" using configuration from",
148148
"@org.springframework.format.annotation.DateTimeFormat",
149149
"style=", "S-", "iso=NONE")
150-
.hasCauseInstanceOf(ParseException.class).getCause()
150+
.hasCauseInstanceOf(ParseException.class).cause()
151151
.hasMessageStartingWith("Unparseable date: \"99/01/01\"")
152152
.hasNoCause();
153153
}
@@ -352,19 +352,19 @@ void patternDateWithUnsupportedPattern() {
352352
FieldError fieldError = bindingResult.getFieldError(propertyName);
353353
assertThat(fieldError.unwrap(TypeMismatchException.class))
354354
.hasMessageContaining("for property 'patternDateWithFallbackPatterns'")
355-
.hasCauseInstanceOf(ConversionFailedException.class).getCause()
355+
.hasCauseInstanceOf(ConversionFailedException.class).cause()
356356
.hasMessageContaining("for value '210302'")
357-
.hasCauseInstanceOf(IllegalArgumentException.class).getCause()
357+
.hasCauseInstanceOf(IllegalArgumentException.class).cause()
358358
.hasMessageContaining("Parse attempt failed for value [210302]")
359-
.hasCauseInstanceOf(ParseException.class).getCause()
359+
.hasCauseInstanceOf(ParseException.class).cause()
360360
// Unable to parse date time value "210302" using configuration from
361361
// @org.springframework.format.annotation.DateTimeFormat(
362362
// pattern=yyyy-MM-dd, style=SS, iso=NONE, fallbackPatterns=[M/d/yy, yyyyMMdd, yyyy.MM.dd])
363363
.hasMessageContainingAll(
364364
"Unable to parse date time value \"210302\" using configuration from",
365365
"@org.springframework.format.annotation.DateTimeFormat",
366366
"yyyy-MM-dd", "M/d/yy", "yyyyMMdd", "yyyy.MM.dd")
367-
.hasCauseInstanceOf(ParseException.class).getCause()
367+
.hasCauseInstanceOf(ParseException.class).cause()
368368
.hasMessageStartingWith("Unparseable date: \"210302\"")
369369
.hasNoCause();
370370
}

spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -333,21 +333,21 @@ void isoLocalDateWithInvalidFormat() {
333333
FieldError fieldError = bindingResult.getFieldError(propertyName);
334334
assertThat(fieldError.unwrap(TypeMismatchException.class))
335335
.hasMessageContaining("for property 'isoLocalDate'")
336-
.hasCauseInstanceOf(ConversionFailedException.class).getCause()
336+
.hasCauseInstanceOf(ConversionFailedException.class).cause()
337337
.hasMessageContaining("for value '2009-31-10'")
338-
.hasCauseInstanceOf(IllegalArgumentException.class).getCause()
338+
.hasCauseInstanceOf(IllegalArgumentException.class).cause()
339339
.hasMessageContaining("Parse attempt failed for value [2009-31-10]")
340-
.hasCauseInstanceOf(DateTimeParseException.class).getCause()
340+
.hasCauseInstanceOf(DateTimeParseException.class).cause()
341341
// Unable to parse date time value "2009-31-10" using configuration from
342342
// @org.springframework.format.annotation.DateTimeFormat(pattern=, style=SS, iso=DATE, fallbackPatterns=[])
343343
// We do not check "fallbackPatterns=[]", since the array representation in the toString()
344344
// implementation for annotations changed from [] to {} in Java 9.
345345
.hasMessageContainingAll(
346346
"Unable to parse date time value \"2009-31-10\" using configuration from",
347347
"@org.springframework.format.annotation.DateTimeFormat", "iso=DATE")
348-
.hasCauseInstanceOf(DateTimeParseException.class).getCause()
348+
.hasCauseInstanceOf(DateTimeParseException.class).cause()
349349
.hasMessageStartingWith("Text '2009-31-10'")
350-
.hasCauseInstanceOf(DateTimeException.class).getCause()
350+
.hasCauseInstanceOf(DateTimeException.class).cause()
351351
.hasMessageContaining("Invalid value for MonthOfYear (valid values 1 - 12): 31")
352352
.hasNoCause();
353353
}
@@ -569,19 +569,19 @@ void patternLocalDateWithUnsupportedPattern() {
569569
FieldError fieldError = bindingResult.getFieldError(propertyName);
570570
assertThat(fieldError.unwrap(TypeMismatchException.class))
571571
.hasMessageContaining("for property 'patternLocalDateWithFallbackPatterns'")
572-
.hasCauseInstanceOf(ConversionFailedException.class).getCause()
572+
.hasCauseInstanceOf(ConversionFailedException.class).cause()
573573
.hasMessageContaining("for value '210302'")
574-
.hasCauseInstanceOf(IllegalArgumentException.class).getCause()
574+
.hasCauseInstanceOf(IllegalArgumentException.class).cause()
575575
.hasMessageContaining("Parse attempt failed for value [210302]")
576-
.hasCauseInstanceOf(DateTimeParseException.class).getCause()
576+
.hasCauseInstanceOf(DateTimeParseException.class).cause()
577577
// Unable to parse date time value "210302" using configuration from
578578
// @org.springframework.format.annotation.DateTimeFormat(
579579
// pattern=yyyy-MM-dd, style=SS, iso=NONE, fallbackPatterns=[M/d/yy, yyyyMMdd, yyyy.MM.dd])
580580
.hasMessageContainingAll(
581581
"Unable to parse date time value \"210302\" using configuration from",
582582
"@org.springframework.format.annotation.DateTimeFormat",
583583
"yyyy-MM-dd", "M/d/yy", "yyyyMMdd", "yyyy.MM.dd")
584-
.hasCauseInstanceOf(DateTimeParseException.class).getCause()
584+
.hasCauseInstanceOf(DateTimeParseException.class).cause()
585585
.hasMessageStartingWith("Text '210302'")
586586
.hasNoCause();
587587
}

0 commit comments

Comments
 (0)