use of cn.taketoday.validation.BindException in project today-framework by TAKETODAY.
the class ErrorResponseExceptionTests method methodArgumentNotValidException.
@Test
void methodArgumentNotValidException() {
BindingResult bindingResult = new BindException(new Object(), "object");
bindingResult.addError(new FieldError("object", "field", "message"));
ErrorResponse ex = new MethodArgumentNotValidException(this.methodParameter, bindingResult);
assertStatus(ex, HttpStatus.BAD_REQUEST);
assertDetail(ex, "Invalid request content.");
assertThat(ex.getHeaders()).isEmpty();
}
Aggregations