I am writing unit test for a controller method that has the following signature
String handlerApplicationRequest(@ModelAttribute("resource") Resource resource, Errors errors, HttpServletRequest request)
to call this method i my unit test, i need to pass all three arguments, I already have an instance of Resource, for testing and i created MockHttpServletRequest instance for the request. But i don't know how to get an instance of org.springframework.validation.Errors. The spring documentation, I don't see any public constructor or any static factory method to instantiate this class. The code i am writing unit test for is not my code but its documentation says, that Errors, holds any errors in processing the request. My question is how can i get an instance of Errors to write my unit test.
Aucun commentaire:
Enregistrer un commentaire