|
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.
|
@@ -333,21 +333,21 @@ void isoLocalDateWithInvalidFormat() {
|
333 | 333 | FieldError fieldError = bindingResult.getFieldError(propertyName);
|
334 | 334 | assertThat(fieldError.unwrap(TypeMismatchException.class))
|
335 | 335 | .hasMessageContaining("for property 'isoLocalDate'")
|
336 |
| - .hasCauseInstanceOf(ConversionFailedException.class).getCause() |
| 336 | + .hasCauseInstanceOf(ConversionFailedException.class).cause() |
337 | 337 | .hasMessageContaining("for value '2009-31-10'")
|
338 |
| - .hasCauseInstanceOf(IllegalArgumentException.class).getCause() |
| 338 | + .hasCauseInstanceOf(IllegalArgumentException.class).cause() |
339 | 339 | .hasMessageContaining("Parse attempt failed for value [2009-31-10]")
|
340 |
| - .hasCauseInstanceOf(DateTimeParseException.class).getCause() |
| 340 | + .hasCauseInstanceOf(DateTimeParseException.class).cause() |
341 | 341 | // Unable to parse date time value "2009-31-10" using configuration from
|
342 | 342 | // @org.springframework.format.annotation.DateTimeFormat(pattern=, style=SS, iso=DATE, fallbackPatterns=[])
|
343 | 343 | // We do not check "fallbackPatterns=[]", since the array representation in the toString()
|
344 | 344 | // implementation for annotations changed from [] to {} in Java 9.
|
345 | 345 | .hasMessageContainingAll(
|
346 | 346 | "Unable to parse date time value \"2009-31-10\" using configuration from",
|
347 | 347 | "@org.springframework.format.annotation.DateTimeFormat", "iso=DATE")
|
348 |
| - .hasCauseInstanceOf(DateTimeParseException.class).getCause() |
| 348 | + .hasCauseInstanceOf(DateTimeParseException.class).cause() |
349 | 349 | .hasMessageStartingWith("Text '2009-31-10'")
|
350 |
| - .hasCauseInstanceOf(DateTimeException.class).getCause() |
| 350 | + .hasCauseInstanceOf(DateTimeException.class).cause() |
351 | 351 | .hasMessageContaining("Invalid value for MonthOfYear (valid values 1 - 12): 31")
|
352 | 352 | .hasNoCause();
|
353 | 353 | }
|
@@ -569,19 +569,19 @@ void patternLocalDateWithUnsupportedPattern() {
|
569 | 569 | FieldError fieldError = bindingResult.getFieldError(propertyName);
|
570 | 570 | assertThat(fieldError.unwrap(TypeMismatchException.class))
|
571 | 571 | .hasMessageContaining("for property 'patternLocalDateWithFallbackPatterns'")
|
572 |
| - .hasCauseInstanceOf(ConversionFailedException.class).getCause() |
| 572 | + .hasCauseInstanceOf(ConversionFailedException.class).cause() |
573 | 573 | .hasMessageContaining("for value '210302'")
|
574 |
| - .hasCauseInstanceOf(IllegalArgumentException.class).getCause() |
| 574 | + .hasCauseInstanceOf(IllegalArgumentException.class).cause() |
575 | 575 | .hasMessageContaining("Parse attempt failed for value [210302]")
|
576 |
| - .hasCauseInstanceOf(DateTimeParseException.class).getCause() |
| 576 | + .hasCauseInstanceOf(DateTimeParseException.class).cause() |
577 | 577 | // Unable to parse date time value "210302" using configuration from
|
578 | 578 | // @org.springframework.format.annotation.DateTimeFormat(
|
579 | 579 | // pattern=yyyy-MM-dd, style=SS, iso=NONE, fallbackPatterns=[M/d/yy, yyyyMMdd, yyyy.MM.dd])
|
580 | 580 | .hasMessageContainingAll(
|
581 | 581 | "Unable to parse date time value \"210302\" using configuration from",
|
582 | 582 | "@org.springframework.format.annotation.DateTimeFormat",
|
583 | 583 | "yyyy-MM-dd", "M/d/yy", "yyyyMMdd", "yyyy.MM.dd")
|
584 |
| - .hasCauseInstanceOf(DateTimeParseException.class).getCause() |
| 584 | + .hasCauseInstanceOf(DateTimeParseException.class).cause() |
585 | 585 | .hasMessageStartingWith("Text '210302'")
|
586 | 586 | .hasNoCause();
|
587 | 587 | }
|
|
0 commit comments