The testing which is carried out with the help of mock objects is called mock testing. There are a number of ways which provide the means for mock testing. Let's discover them one by one.
Spring provides an API to conduct testing using the mock technique in JUnit. Using this API, we can create mock objects of
HttpSession, which is otherwise available from the container. All those methods which are dependent on request or user's request and response can now be tested easily without a container. Using this API, tests can be created even before the development of the controller has been completed with mocking or stubbing.
Let's use it in our controller testing which we developed in ...