类 ModelResultMatchers
java.lang.Object
cn.taketoday.test.web.servlet.result.ModelResultMatchers
Factory for assertions on the model.
An instance of this class is typically accessed via
MockMvcResultMatchers.model().
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Sam Brannen
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Assert a model attribute value.<T> ResultMatcherAssert a model attribute value with the given HamcrestMatcher.attributeDoesNotExist(String... names) Assert the given model attributes do not exist.attributeErrorCount(String name, int expectedCount) Assert the given model attribute(s) have errors.attributeExists(String... names) Assert the given model attributes exist.attributeHasErrors(String... names) Assert the given model attribute(s) have errors.attributeHasFieldErrorCode(String name, String fieldName, String error) Assert a field error code for a model attribute using exact String match.attributeHasFieldErrorCode(String name, String fieldName, org.hamcrest.Matcher<? super String> matcher) Assert a field error code for a model attribute using aMatcher.attributeHasFieldErrors(String name, String... fieldNames) Assert the given model attribute field(s) have errors.attributeHasNoErrors(String... names) Assert the given model attribute(s) do not have errors.errorCount(int expectedCount) Assert the total number of errors in the model.private cn.taketoday.validation.BindingResultgetBindingResult(cn.taketoday.web.view.ModelAndView mav, String name) private intgetErrorCount(cn.taketoday.ui.ModelMap model) private cn.taketoday.web.view.ModelAndViewgetModelAndView(MvcResult mvcResult) Assert the model has errors.Assert the model has no errors.size(int size) Assert the number of model attributes.
-
构造器详细资料
-
ModelResultMatchers
protected ModelResultMatchers()Protected constructor. UseMockMvcResultMatchers.model().
-
-
方法详细资料
-
attribute
Assert a model attribute value with the given HamcrestMatcher. -
attribute
Assert a model attribute value. -
attributeExists
Assert the given model attributes exist. -
attributeDoesNotExist
Assert the given model attributes do not exist. -
attributeErrorCount
Assert the given model attribute(s) have errors. -
attributeHasErrors
Assert the given model attribute(s) have errors. -
attributeHasNoErrors
Assert the given model attribute(s) do not have errors. -
attributeHasFieldErrors
Assert the given model attribute field(s) have errors. -
attributeHasFieldErrorCode
Assert a field error code for a model attribute using exact String match. -
attributeHasFieldErrorCode
public ResultMatcher attributeHasFieldErrorCode(String name, String fieldName, org.hamcrest.Matcher<? super String> matcher) Assert a field error code for a model attribute using aMatcher. -
errorCount
Assert the total number of errors in the model. -
hasErrors
Assert the model has errors. -
hasNoErrors
Assert the model has no errors. -
size
Assert the number of model attributes. -
getModelAndView
-
getBindingResult
private cn.taketoday.validation.BindingResult getBindingResult(cn.taketoday.web.view.ModelAndView mav, String name) -
getErrorCount
private int getErrorCount(cn.taketoday.ui.ModelMap model)
-