KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.mockobjects.servlet;
2
3 import javax.servlet.*;
4 import junit.framework.*;
5 import junit.textui.*;
6 import java.util.*;
7 import java.io.*;
8 import java.net.*;
9 import com.mockobjects.*;
10
11 /**
12  * @version $Revision: 1.1 $
13  */

14 public class MockServletConfig extends MockObject implements ServletConfig {
15     private Dictionary myParameters = new Hashtable();
16     private ServletContext servletContext;
17
18     public String JavaDoc getInitParameter(String JavaDoc paramName) {
19         return (String JavaDoc)myParameters.get(paramName);
20     }
21
22     public void setInitParameter(String JavaDoc paramName, String JavaDoc paramValue) {
23         myParameters.put(paramName, paramValue);
24     }
25
26     public java.util.Enumeration JavaDoc getInitParameterNames() {
27         return myParameters.keys();
28     }
29
30     public void setupAddInitParameter(String JavaDoc paramName, String JavaDoc value) {
31         myParameters.put(paramName, value);
32     }
33
34     public void setupNoParameters() {
35         myParameters = new Hashtable();
36     }
37
38     public void setServletContext(ServletContext servletContext){
39         this.servletContext = servletContext;
40     }
41
42     public ServletContext getServletContext(){
43         return servletContext;
44     }
45     public String JavaDoc getServletName(){
46         return null;
47     }
48 }
49
50
Popular Tags