1 37 package net.sourceforge.cruisecontrol.mock; 38 39 import java.io.IOException ; 40 import java.io.PrintWriter ; 41 import java.io.StringWriter ; 42 import java.util.Locale ; 43 44 import javax.servlet.ServletOutputStream ; 45 import javax.servlet.http.Cookie ; 46 import javax.servlet.http.HttpServletResponse ; 47 48 51 public class MockServletResponse implements HttpServletResponse { 52 private StringWriter stringWriter = new StringWriter (); 53 private PrintWriter writer = new PrintWriter (stringWriter); 54 private String contentType; 55 private int status; 56 private ServletOutputStream outputStream = new MockServletOutputStream(stringWriter); 57 58 public String getContentType() { 59 return contentType; 60 } 61 62 public int getStatus() { 63 return status; 64 } 65 66 public String getWritten() { 67 return stringWriter.getBuffer().toString(); 68 } 69 70 73 public void addCookie(Cookie arg0) { 74 } 75 76 79 public boolean containsHeader(String arg0) { 80 return false; 81 } 82 83 86 public String encodeURL(String arg0) { 87 return null; 88 } 89 90 93 public String encodeRedirectURL(String arg0) { 94 return null; 95 } 96 97 100 public String encodeUrl(String arg0) { 101 return null; 102 } 103 104 107 public String encodeRedirectUrl(String arg0) { 108 return null; 109 } 110 111 114 public void sendError(int arg0, String arg1) throws IOException { 115 } 116 117 120 public void sendError(int arg0) throws IOException { 121 } 122 123 126 public void sendRedirect(String arg0) throws IOException { 127 } 128 129 132 public void setDateHeader(String arg0, long arg1) { 133 } 134 135 138 public void addDateHeader(String arg0, long arg1) { 139 } 140 141 144 public void setHeader(String arg0, String arg1) { 145 } 146 147 150 public void addHeader(String arg0, String arg1) { 151 } 152 153 156 public void setIntHeader(String arg0, int arg1) { 157 } 158 159 162 public void addIntHeader(String arg0, int arg1) { 163 } 164 165 168 public void setStatus(int arg0) { 169 status = arg0; 170 } 171 172 175 public void setStatus(int arg0, String arg1) { 176 status = arg0; 177 } 178 179 182 public String getCharacterEncoding() { 183 return null; 184 } 185 186 189 public ServletOutputStream getOutputStream() throws IOException { 190 return outputStream; 191 } 192 193 196 public PrintWriter getWriter() throws IOException { 197 return writer; 198 } 199 200 203 public void setContentLength(int arg0) { 204 } 205 206 209 public void setContentType(String type) { 210 contentType = type; 211 } 212 213 216 public void setBufferSize(int arg0) { 217 } 218 219 222 public int getBufferSize() { 223 return 0; 224 } 225 226 229 public void flushBuffer() throws IOException { 230 } 231 232 235 public boolean isCommitted() { 236 return false; 237 } 238 239 242 public void reset() { 243 } 244 245 248 public void setLocale(Locale arg0) { 249 } 250 251 254 public Locale getLocale() { 255 return null; 256 } 257 } 258 | Popular Tags |