|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -333,11 +333,11 @@ class DateTimeFormattingTests {
@@ -333,11 +333,11 @@ class DateTimeFormattingTests {
|
|
|
|
|
FieldError fieldError = bindingResult.getFieldError(propertyName); |
|
|
|
|
assertThat(fieldError.unwrap(TypeMismatchException.class)) |
|
|
|
|
.hasMessageContaining("for property 'isoLocalDate'") |
|
|
|
|
.hasCauseInstanceOf(ConversionFailedException.class).getCause() |
|
|
|
|
.hasCauseInstanceOf(ConversionFailedException.class).cause() |
|
|
|
|
.hasMessageContaining("for value '2009-31-10'") |
|
|
|
|
.hasCauseInstanceOf(IllegalArgumentException.class).getCause() |
|
|
|
|
.hasCauseInstanceOf(IllegalArgumentException.class).cause() |
|
|
|
|
.hasMessageContaining("Parse attempt failed for value [2009-31-10]") |
|
|
|
|
.hasCauseInstanceOf(DateTimeParseException.class).getCause() |
|
|
|
|
.hasCauseInstanceOf(DateTimeParseException.class).cause() |
|
|
|
|
// 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()
|
|
|
|
|
@ -345,9 +345,9 @@ class DateTimeFormattingTests {
@@ -345,9 +345,9 @@ class DateTimeFormattingTests {
|
|
|
|
|
.hasMessageContainingAll( |
|
|
|
|
"Unable to parse date time value \"2009-31-10\" using configuration from", |
|
|
|
|
"@org.springframework.format.annotation.DateTimeFormat", "iso=DATE") |
|
|
|
|
.hasCauseInstanceOf(DateTimeParseException.class).getCause() |
|
|
|
|
.hasCauseInstanceOf(DateTimeParseException.class).cause() |
|
|
|
|
.hasMessageStartingWith("Text '2009-31-10'") |
|
|
|
|
.hasCauseInstanceOf(DateTimeException.class).getCause() |
|
|
|
|
.hasCauseInstanceOf(DateTimeException.class).cause() |
|
|
|
|
.hasMessageContaining("Invalid value for MonthOfYear (valid values 1 - 12): 31") |
|
|
|
|
.hasNoCause(); |
|
|
|
|
} |
|
|
|
|
@ -569,11 +569,11 @@ class DateTimeFormattingTests {
@@ -569,11 +569,11 @@ class DateTimeFormattingTests {
|
|
|
|
|
FieldError fieldError = bindingResult.getFieldError(propertyName); |
|
|
|
|
assertThat(fieldError.unwrap(TypeMismatchException.class)) |
|
|
|
|
.hasMessageContaining("for property 'patternLocalDateWithFallbackPatterns'") |
|
|
|
|
.hasCauseInstanceOf(ConversionFailedException.class).getCause() |
|
|
|
|
.hasCauseInstanceOf(ConversionFailedException.class).cause() |
|
|
|
|
.hasMessageContaining("for value '210302'") |
|
|
|
|
.hasCauseInstanceOf(IllegalArgumentException.class).getCause() |
|
|
|
|
.hasCauseInstanceOf(IllegalArgumentException.class).cause() |
|
|
|
|
.hasMessageContaining("Parse attempt failed for value [210302]") |
|
|
|
|
.hasCauseInstanceOf(DateTimeParseException.class).getCause() |
|
|
|
|
.hasCauseInstanceOf(DateTimeParseException.class).cause() |
|
|
|
|
// Unable to parse date time value "210302" using configuration from
|
|
|
|
|
// @org.springframework.format.annotation.DateTimeFormat(
|
|
|
|
|
// pattern=yyyy-MM-dd, style=SS, iso=NONE, fallbackPatterns=[M/d/yy, yyyyMMdd, yyyy.MM.dd])
|
|
|
|
|
@ -581,7 +581,7 @@ class DateTimeFormattingTests {
@@ -581,7 +581,7 @@ class DateTimeFormattingTests {
|
|
|
|
|
"Unable to parse date time value \"210302\" using configuration from", |
|
|
|
|
"@org.springframework.format.annotation.DateTimeFormat", |
|
|
|
|
"yyyy-MM-dd", "M/d/yy", "yyyyMMdd", "yyyy.MM.dd") |
|
|
|
|
.hasCauseInstanceOf(DateTimeParseException.class).getCause() |
|
|
|
|
.hasCauseInstanceOf(DateTimeParseException.class).cause() |
|
|
|
|
.hasMessageStartingWith("Text '210302'") |
|
|
|
|
.hasNoCause(); |
|
|
|
|
} |
|
|
|
|
|