i want to create unitest for upload file method, which accepts HttpServletRequest object . But i don’t know how to create this object and pass in all the form data without executing servlet. Is there a way to do this?
i want to create unitest for upload file method, which accepts HttpServletRequest object .
Share
Create a mock HttpServletRequest instance (using Mockito or another mocking library).
Edit: See also a related question. Actually, subclassing HttpServletRequest is a way as well.