KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > servlet > MockRequestDispatcher


1 package com.mockobjects.servlet;
2
3 import com.mockobjects.ExpectationValue;
4 import com.mockobjects.MockObject;
5
6 import javax.servlet.RequestDispatcher JavaDoc;
7 import javax.servlet.ServletException JavaDoc;
8 import javax.servlet.ServletRequest JavaDoc;
9 import javax.servlet.ServletResponse JavaDoc;
10 import java.io.IOException JavaDoc;
11
12 public class MockRequestDispatcher extends MockObject implements RequestDispatcher JavaDoc {
13     private final ExpectationValue myRequest = new ExpectationValue("request");
14     private final ExpectationValue myResponse = new ExpectationValue("response");
15
16     public void setExpectedRequest(ServletRequest JavaDoc aRequest) {
17         myRequest.setExpected(aRequest);
18     }
19
20     public void setExpectedResponse(ServletResponse JavaDoc aResponse) {
21         myResponse.setExpected(aResponse);
22     }
23
24     public void forward(ServletRequest JavaDoc aRequest, ServletResponse JavaDoc aResponse)
25         throws ServletException JavaDoc, IOException JavaDoc {
26
27         myRequest.setActual(aRequest);
28         myResponse.setActual(aResponse);
29     }
30
31     public void include(ServletRequest JavaDoc aRequest, ServletResponse JavaDoc aResponse)
32         throws ServletException JavaDoc, IOException JavaDoc {
33
34         myRequest.setActual(aRequest);
35         myResponse.setActual(aResponse);
36     }
37 }
38
Popular Tags