KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > mock > MockHttpServletResponse


1 /*
2  * $Id: MockHttpServletResponse.java 54929 2004-10-16 16:38:42Z germuska $
3  *
4  * Copyright 1999-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19
20 package org.apache.struts.mock;
21
22
23 import java.io.IOException JavaDoc;
24 import java.io.PrintWriter JavaDoc;
25 import java.util.Locale JavaDoc;
26 import javax.servlet.ServletOutputStream JavaDoc;
27 import javax.servlet.http.Cookie JavaDoc;
28 import javax.servlet.http.HttpServletResponse JavaDoc;
29
30
31
32 /**
33  * <p>Mock <strong>HttpServletResponse</strong> object for low-level unit tests
34  * of Struts controller components. Coarser grained tests should be
35  * implemented in terms of the Cactus framework, instead of the mock
36  * object classes.</p>
37  *
38  * <p><strong>WARNING</strong> - Only the minimal set of methods needed to
39  * create unit tests is provided, plus additional methods to configure this
40  * object as necessary. Methods for unsupported operations will throw
41  * <code>UnsupportedOperationException</code>.</p>
42  *
43  * <p><strong>WARNING</strong> - Because unit tests operate in a single
44  * threaded environment, no synchronization is performed.</p>
45  *
46  * @version $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $
47  */

48
49 public class MockHttpServletResponse implements HttpServletResponse JavaDoc {
50
51
52
53     // ----------------------------------------------------- Instance Variables
54

55
56     // --------------------------------------------------------- Public Methods
57

58
59
60
61     // -------------------------------------------- HttpServletResponse Methods
62

63
64     public void addCookie(Cookie JavaDoc cookie) {
65         throw new UnsupportedOperationException JavaDoc();
66     }
67
68
69     public void addDateHeader(String JavaDoc name, long value) {
70         throw new UnsupportedOperationException JavaDoc();
71     }
72
73
74     public void addHeader(String JavaDoc name, String JavaDoc value) {
75         throw new UnsupportedOperationException JavaDoc();
76     }
77
78
79     public void addIntHeader(String JavaDoc name, int value) {
80         throw new UnsupportedOperationException JavaDoc();
81     }
82
83
84     public boolean containsHeader(String JavaDoc name) {
85         throw new UnsupportedOperationException JavaDoc();
86     }
87
88
89     public String JavaDoc encodeRedirectUrl(String JavaDoc url) {
90         return (encodeRedirectURL(url));
91     }
92
93
94     public String JavaDoc encodeRedirectURL(String JavaDoc url) {
95         return (url);
96     }
97
98
99     public String JavaDoc encodeUrl(String JavaDoc url) {
100         return (encodeURL(url));
101     }
102
103
104     public String JavaDoc encodeURL(String JavaDoc url) {
105         return (url);
106     }
107
108
109     public void sendError(int status) {
110         throw new UnsupportedOperationException JavaDoc();
111     }
112
113
114     public void sendError(int status, String JavaDoc message) {
115         throw new UnsupportedOperationException JavaDoc();
116     }
117
118
119     public void sendRedirect(String JavaDoc location) {
120         throw new UnsupportedOperationException JavaDoc();
121     }
122
123
124     public void setDateHeader(String JavaDoc name, long value) {
125         throw new UnsupportedOperationException JavaDoc();
126     }
127
128
129     public void setHeader(String JavaDoc name, String JavaDoc value) {
130         throw new UnsupportedOperationException JavaDoc();
131     }
132
133
134     public void setIntHeader(String JavaDoc name, int value) {
135         throw new UnsupportedOperationException JavaDoc();
136     }
137
138
139     public void setStatus(int status) {
140         throw new UnsupportedOperationException JavaDoc();
141     }
142
143
144     public void setStatus(int status, String JavaDoc message) {
145         throw new UnsupportedOperationException JavaDoc();
146     }
147
148
149     // ------------------------------------------------ ServletResponse Methods
150

151
152     public void flushBuffer() {
153         throw new UnsupportedOperationException JavaDoc();
154     }
155
156
157     public int getBufferSize() {
158         throw new UnsupportedOperationException JavaDoc();
159     }
160
161
162     public String JavaDoc getCharacterEncoding() {
163         throw new UnsupportedOperationException JavaDoc();
164     }
165
166
167     public Locale JavaDoc getLocale() {
168         throw new UnsupportedOperationException JavaDoc();
169     }
170
171
172     public ServletOutputStream JavaDoc getOutputStream() throws IOException JavaDoc {
173         throw new UnsupportedOperationException JavaDoc();
174     }
175
176
177     public PrintWriter JavaDoc getWriter() throws IOException JavaDoc {
178         throw new UnsupportedOperationException JavaDoc();
179     }
180
181
182     public boolean isCommitted() {
183         throw new UnsupportedOperationException JavaDoc();
184     }
185
186
187     public void reset() {
188         throw new UnsupportedOperationException JavaDoc();
189     }
190
191
192     public void resetBuffer() {
193         throw new UnsupportedOperationException JavaDoc();
194     }
195
196
197     public void setBufferSize(int size) {
198         throw new UnsupportedOperationException JavaDoc();
199     }
200
201
202     public void setContentLength(int length) {
203         throw new UnsupportedOperationException JavaDoc();
204     }
205
206
207     public void setContentType(String JavaDoc type) {
208         throw new UnsupportedOperationException JavaDoc();
209     }
210
211
212     public void setLocale(Locale JavaDoc locale) {
213         throw new UnsupportedOperationException JavaDoc();
214     }
215
216
217 }
218
Popular Tags