1 7 package com.inversoft.junit.examples; 8 9 10 import java.io.IOException ; 11 import javax.servlet.RequestDispatcher ; 12 import javax.servlet.ServletException ; 13 import javax.servlet.http.HttpServletRequestWrapper ; 14 15 import com.inversoft.junit.Request; 16 import com.inversoft.junit.Response; 17 import com.inversoft.junit.WebTestCase; 18 19 20 23 public class SimpleWebTest extends WebTestCase { 24 25 private static int count = 0; 26 27 28 31 public SimpleWebTest(String name) { 32 super(name); 33 } 34 35 36 39 public void beginFoo(Request request) { 40 System.err.println("Inside begin foo: " + count); 41 count++; 42 } 43 public void testFoo() { 44 System.err.println("Inside test foo"); 45 } 46 public void endFoo(Response response) { 47 System.err.println("Inside end foo"); 48 } 49 50 53 public void beginJSP(Request request) { 54 System.err.println("Inside begin JSP"); 55 } 56 public void testJSP() throws IOException , ServletException { 57 System.err.println("Inside test JSP"); 58 RequestDispatcher rd = request.getRequestDispatcher("/test.jsp"); 59 rd.forward(request, response); 60 } 61 public void endJSP(Response response) { 62 System.err.println("Inside end JSP"); 63 } 64 65 69 public void beginFailure(Request request) { 70 System.err.println("Inside begin failure"); 71 } 72 public void testFailure() { 73 System.err.println("Inside test failure"); 74 assertTrue("Failure", false); 75 } 76 public void endFailure(Response response) { 77 System.err.println("Inside end failure"); 78 } 79 } | Popular Tags |