|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2021 the original author or authors. |
| 2 | + * Copyright 2002-2022 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -332,21 +332,21 @@ void isoLocalDateWithInvalidFormat() {
|
332 | 332 | FieldError fieldError = bindingResult.getFieldError(propertyName);
|
333 | 333 | assertThat(fieldError.unwrap(TypeMismatchException.class))
|
334 | 334 | .hasMessageContaining("for property 'isoLocalDate'")
|
335 |
| - .hasCauseInstanceOf(ConversionFailedException.class).getCause() |
| 335 | + .hasCauseInstanceOf(ConversionFailedException.class).cause() |
336 | 336 | .hasMessageContaining("for value '2009-31-10'")
|
337 |
| - .hasCauseInstanceOf(IllegalArgumentException.class).getCause() |
| 337 | + .hasCauseInstanceOf(IllegalArgumentException.class).cause() |
338 | 338 | .hasMessageContaining("Parse attempt failed for value [2009-31-10]")
|
339 |
| - .hasCauseInstanceOf(DateTimeParseException.class).getCause() |
| 339 | + .hasCauseInstanceOf(DateTimeParseException.class).cause() |
340 | 340 | // Unable to parse date time value "2009-31-10" using configuration from
|
341 | 341 | // @org.springframework.format.annotation.DateTimeFormat(pattern=, style=SS, iso=DATE, fallbackPatterns=[])
|
342 | 342 | // We do not check "fallbackPatterns=[]", since the array representation in the toString()
|
343 | 343 | // implementation for annotations changed from [] to {} in Java 9.
|
344 | 344 | .hasMessageContainingAll(
|
345 | 345 | "Unable to parse date time value \"2009-31-10\" using configuration from",
|
346 | 346 | "@org.springframework.format.annotation.DateTimeFormat", "iso=DATE")
|
347 |
| - .hasCauseInstanceOf(DateTimeParseException.class).getCause() |
| 347 | + .hasCauseInstanceOf(DateTimeParseException.class).cause() |
348 | 348 | .hasMessageStartingWith("Text '2009-31-10'")
|
349 |
| - .hasCauseInstanceOf(DateTimeException.class).getCause() |
| 349 | + .hasCauseInstanceOf(DateTimeException.class).cause() |
350 | 350 | .hasMessageContaining("Invalid value for MonthOfYear (valid values 1 - 12): 31")
|
351 | 351 | .hasNoCause();
|
352 | 352 | }
|
@@ -539,19 +539,19 @@ void patternLocalDateWithUnsupportedPattern() {
|
539 | 539 | FieldError fieldError = bindingResult.getFieldError(propertyName);
|
540 | 540 | assertThat(fieldError.unwrap(TypeMismatchException.class))
|
541 | 541 | .hasMessageContaining("for property 'patternLocalDateWithFallbackPatterns'")
|
542 |
| - .hasCauseInstanceOf(ConversionFailedException.class).getCause() |
| 542 | + .hasCauseInstanceOf(ConversionFailedException.class).cause() |
543 | 543 | .hasMessageContaining("for value '210302'")
|
544 |
| - .hasCauseInstanceOf(IllegalArgumentException.class).getCause() |
| 544 | + .hasCauseInstanceOf(IllegalArgumentException.class).cause() |
545 | 545 | .hasMessageContaining("Parse attempt failed for value [210302]")
|
546 |
| - .hasCauseInstanceOf(DateTimeParseException.class).getCause() |
| 546 | + .hasCauseInstanceOf(DateTimeParseException.class).cause() |
547 | 547 | // Unable to parse date time value "210302" using configuration from
|
548 | 548 | // @org.springframework.format.annotation.DateTimeFormat(
|
549 | 549 | // pattern=yyyy-MM-dd, style=SS, iso=NONE, fallbackPatterns=[M/d/yy, yyyyMMdd, yyyy.MM.dd])
|
550 | 550 | .hasMessageContainingAll(
|
551 | 551 | "Unable to parse date time value \"210302\" using configuration from",
|
552 | 552 | "@org.springframework.format.annotation.DateTimeFormat",
|
553 | 553 | "yyyy-MM-dd", "M/d/yy", "yyyyMMdd", "yyyy.MM.dd")
|
554 |
| - .hasCauseInstanceOf(DateTimeParseException.class).getCause() |
| 554 | + .hasCauseInstanceOf(DateTimeParseException.class).cause() |
555 | 555 | .hasMessageStartingWith("Text '210302'")
|
556 | 556 | .hasNoCause();
|
557 | 557 | }
|
|
0 commit comments