mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '3.1.x' into 3.2.x
Closes gh-40364
This commit is contained in:
commit
5058719242
@ -47,9 +47,9 @@ class BindValidationFailureAnalyzer extends AbstractFailureAnalyzer<Throwable> {
|
||||
private ExceptionDetails getBindValidationExceptionDetails(Throwable rootFailure) {
|
||||
BindValidationException validationException = findCause(rootFailure, BindValidationException.class);
|
||||
if (validationException != null) {
|
||||
BindException target = findCause(rootFailure, BindException.class);
|
||||
BindException bindException = findCause(rootFailure, BindException.class);
|
||||
List<ObjectError> errors = validationException.getValidationErrors().getAllErrors();
|
||||
return new ExceptionDetails(errors, target, validationException);
|
||||
return new ExceptionDetails(errors, bindException.getTarget().getType(), validationException);
|
||||
}
|
||||
org.springframework.validation.BindException bindException = findCause(rootFailure,
|
||||
org.springframework.validation.BindException.class);
|
||||
|
@ -63,9 +63,11 @@ class BindValidationFailureAnalyzerTests {
|
||||
@Test
|
||||
void bindExceptionWithFieldErrorsDueToValidationFailure() {
|
||||
FailureAnalysis analysis = performAnalysis(FieldValidationFailureConfiguration.class);
|
||||
assertThat(analysis.getDescription()).contains(failure("test.foo.foo", "null", "must not be null"));
|
||||
assertThat(analysis.getDescription()).contains(failure("test.foo.value", "0", "at least five"));
|
||||
assertThat(analysis.getDescription()).contains(failure("test.foo.nested.bar", "null", "must not be null"));
|
||||
assertThat(analysis.getDescription()).contains(failure("test.foo.foo", "null", "must not be null"))
|
||||
.contains(failure("test.foo.value", "0", "at least five"))
|
||||
.contains(failure("test.foo.nested.bar", "null", "must not be null"))
|
||||
.contains(
|
||||
"Binding to target org.springframework.boot.diagnostics.analyzer.BindValidationFailureAnalyzerTests$FieldValidationFailureProperties failed:");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user