use of cn.taketoday.validation.MapBindingResult in project today-infrastructure by TAKETODAY.
the class DefaultErrorAttributesTests method withoutBindingErrors.
@Test
void withoutBindingErrors() {
BindingResult bindingResult = new MapBindingResult(Collections.singletonMap("a", "b"), "objectName");
bindingResult.addError(new ObjectError("c", "d"));
Exception ex = new BindException(bindingResult);
testBindingResult(bindingResult, ex, ErrorAttributeOptions.defaults());
}
use of cn.taketoday.validation.MapBindingResult in project today-infrastructure by TAKETODAY.
the class DefaultErrorAttributesTests method withBindingErrors.
@Test
void withBindingErrors() {
BindingResult bindingResult = new MapBindingResult(Collections.singletonMap("a", "b"), "objectName");
bindingResult.addError(new ObjectError("c", "d"));
Exception ex = new BindException(bindingResult);
testBindingResult(bindingResult, ex, ErrorAttributeOptions.of(Include.MESSAGE, Include.BINDING_ERRORS));
}
use of cn.taketoday.validation.MapBindingResult in project today-framework by TAKETODAY.
the class ResponseEntityExceptionHandlerTests method methodArgumentNotValid.
@Test
public void methodArgumentNotValid() throws Exception {
Exception ex = new MethodArgumentNotValidException(new MethodParameter(getClass().getDeclaredMethod("handle", String.class), 0), new MapBindingResult(Collections.emptyMap(), "name"));
testException(ex);
}
use of cn.taketoday.validation.MapBindingResult in project today-framework by TAKETODAY.
the class DefaultErrorAttributesTests method withoutBindingErrors.
@Test
void withoutBindingErrors() {
BindingResult bindingResult = new MapBindingResult(Collections.singletonMap("a", "b"), "objectName");
bindingResult.addError(new ObjectError("c", "d"));
Exception ex = new BindException(bindingResult);
testBindingResult(bindingResult, ex, ErrorAttributeOptions.defaults());
}
use of cn.taketoday.validation.MapBindingResult in project today-framework by TAKETODAY.
the class DefaultErrorAttributesTests method withBindingErrors.
@Test
void withBindingErrors() {
BindingResult bindingResult = new MapBindingResult(Collections.singletonMap("a", "b"), "objectName");
bindingResult.addError(new ObjectError("c", "d"));
Exception ex = new BindException(bindingResult);
testBindingResult(bindingResult, ex, ErrorAttributeOptions.of(Include.MESSAGE, Include.BINDING_ERRORS));
}
Aggregations