1 package com.mockobjects.helpers; 2 3 import javax.servlet.ServletException ; 4 import javax.servlet.http.HttpServlet ; 5 import java.io.IOException ; 6 7 13 public class ServletTestHelper extends AbstractServletTestHelper { 14 private final HttpServlet testSubject; 15 16 public ServletTestHelper(HttpServlet testSubject) { 17 super(); 18 this.testSubject = testSubject; 19 } 20 21 24 public void testServletInit() throws ServletException { 25 testSubject.init(servletConfig); 26 } 27 28 31 public void testServlet() throws ServletException , IOException { 32 testSubject.service(request, response); 33 } 34 35 public void testDoPost() throws ServletException , IOException { 36 request.setupGetMethod("POST"); 37 testServlet(); 38 } 39 40 public void testDoGet() throws ServletException , IOException { 41 request.setupGetMethod("GET"); 42 testServlet(); 43 } 44 45 } 46 | Popular Tags |