Commit 0f2d91c7 authored by Stephane Nicoll's avatar Stephane Nicoll

Fix broken build

Hibernate Validator 6 has a slightly different structure for default
messages. This commit adapts our tests accordingly.

See gh-9969
parent 8c0ffa33
...@@ -66,11 +66,11 @@ public class BindValidationFailureAnalyzerTests { ...@@ -66,11 +66,11 @@ public class BindValidationFailureAnalyzerTests {
FailureAnalysis analysis = performAnalysis( FailureAnalysis analysis = performAnalysis(
FieldValidationFailureConfiguration.class); FieldValidationFailureConfiguration.class);
assertThat(analysis.getDescription()) assertThat(analysis.getDescription())
.contains(failure("test.foo.foo", "null", "may not be null")); .contains(failure("test.foo.foo", "null", "must not be null"));
assertThat(analysis.getDescription()) assertThat(analysis.getDescription())
.contains(failure("test.foo.value", "0", "at least five")); .contains(failure("test.foo.value", "0", "at least five"));
assertThat(analysis.getDescription()) assertThat(analysis.getDescription())
.contains(failure("test.foo.nested.bar", "null", "may not be null")); .contains(failure("test.foo.nested.bar", "null", "must not be null"));
} }
@Test @Test
...@@ -93,13 +93,13 @@ public class BindValidationFailureAnalyzerTests { ...@@ -93,13 +93,13 @@ public class BindValidationFailureAnalyzerTests {
public void otherBindExceptionShouldReturnAnalysis() throws Exception { public void otherBindExceptionShouldReturnAnalysis() throws Exception {
BindException cause = new BindException(new FieldValidationFailureProperties(), BindException cause = new BindException(new FieldValidationFailureProperties(),
"fieldValidationFailureProperties"); "fieldValidationFailureProperties");
cause.addError(new FieldError("test", "value", "may not be null")); cause.addError(new FieldError("test", "value", "must not be null"));
BeanCreationException rootFailure = new BeanCreationException( BeanCreationException rootFailure = new BeanCreationException(
"bean creation failure", cause); "bean creation failure", cause);
FailureAnalysis analysis = new BindValidationFailureAnalyzer() FailureAnalysis analysis = new BindValidationFailureAnalyzer()
.analyze(rootFailure, rootFailure); .analyze(rootFailure, rootFailure);
assertThat(analysis.getDescription()) assertThat(analysis.getDescription())
.contains(failure("test.value", "null", "may not be null")); .contains(failure("test.value", "null", "must not be null"));
} }
private static String failure(String property, String value, String reason) { private static String failure(String property, String value, String reason) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment