How do I pass the HttpServletRequest object to the test case? [duplicate]

Spring provides a class called MockHttpServletRequest, which can be used to test code that needs a HttpServletRequest.

public void testCheckBatchExecutionSchedule() throws Exception
{
   MockHttpServletRequest request = new MockHttpServletRequest();
   request.addParameter("parameterName", "someValue");
   assertTrue("Batch is Completed :", returnPointsRatingDisputeFrom.checkBatchExecutionSchedule(request));
}

Leave a Comment