Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
../../../../img/srcFileCovDistChart3.png 44% of files have more coverage
26   194   35   0,74
0   115   1,35   35
35     1  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  MockHttpServletResponse       Line # 51 26 0% 35 46 24,6% 0.24590164
 
  (18)
 
1    /*
2    * Copyright (c) 2003-2006, Simon Brown
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    *
8    * - Redistributions of source code must retain the above copyright
9    * notice, this list of conditions and the following disclaimer.
10    *
11    * - Redistributions in binary form must reproduce the above copyright
12    * notice, this list of conditions and the following disclaimer in
13    * the documentation and/or other materials provided with the
14    * distribution.
15    *
16    * - Neither the name of Pebble nor the names of its contributors may
17    * be used to endorse or promote products derived from this software
18    * without specific prior written permission.
19    *
20    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23    * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30    * POSSIBILITY OF SUCH DAMAGE.
31    */
32    package net.sourceforge.pebble.mock;
33   
34    import javax.servlet.ServletOutputStream;
35    import javax.servlet.http.Cookie;
36    import javax.servlet.http.HttpServletResponse;
37    import java.io.IOException;
38    import java.io.PrintWriter;
39    import java.io.StringWriter;
40    import java.text.SimpleDateFormat;
41    import java.util.Date;
42    import java.util.Locale;
43    import java.util.Properties;
44    import java.util.TimeZone;
45   
46    /**
47    * A mock HttpServletResponse implementation.
48    *
49    * @author Simon Brown
50    */
 
51    public class MockHttpServletResponse implements HttpServletResponse {
52   
53    private String contentType = "text/html";
54   
55    private int status = HttpServletResponse.SC_OK;
56   
57    private Properties headers = new Properties();
58   
59    private PrintWriter writer = new PrintWriter(new StringWriter());
60    private String sendRedirect;
61   
 
62  26 toggle public void addCookie(Cookie cookie) {
63    }
64   
 
65  0 toggle public boolean containsHeader(String s) {
66  0 return false;
67    }
68   
 
69  0 toggle public String encodeURL(String s) {
70  0 return null;
71    }
72   
 
73  0 toggle public String encodeRedirectURL(String s) {
74  0 return null;
75    }
76   
 
77  0 toggle public String encodeUrl(String s) {
78  0 return null;
79    }
80   
 
81  0 toggle public String encodeRedirectUrl(String s) {
82  0 return null;
83    }
84   
 
85  0 toggle public void sendError(int i, String s) throws IOException {
86  0 this.status = i;
87    }
88   
 
89  0 toggle public void sendError(int i) throws IOException {
90  0 this.status = i;
91    }
92   
 
93  0 toggle public void sendRedirect(String s) throws IOException {
94  0 this.sendRedirect = s;
95    }
96   
 
97  0 toggle public String getSendRedirect() {
98  0 return this.sendRedirect;
99    }
100   
 
101  14 toggle public void setDateHeader(String name, long value) {
102  14 SimpleDateFormat httpFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
103  14 httpFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
104  14 setHeader(name, "" + httpFormat.format(new Date(value)));
105    }
106   
 
107  0 toggle public void addDateHeader(String s, long l) {
108    }
109   
 
110  28 toggle public void setHeader(String name, String value) {
111  28 headers.put(name, value);
112    }
113   
 
114  0 toggle public void addHeader(String name, String value) {
115  0 headers.put(name, value);
116    }
117   
 
118  6 toggle public String getHeader(String name) {
119  6 return headers.getProperty(name);
120    }
121   
 
122  0 toggle public void setIntHeader(String s, int i) {
123    }
124   
 
125  0 toggle public void addIntHeader(String s, int i) {
126    }
127   
 
128  0 toggle public void setStatus(int i) {
129  0 this.status = i;
130    }
131   
 
132  0 toggle public void setStatus(int i, String s) {
133  0 this.status = i;
134    }
135   
 
136  6 toggle public int getStatus() {
137  6 return this.status;
138    }
139   
 
140  0 toggle public String getCharacterEncoding() {
141  0 return null;
142    }
143   
 
144  0 toggle public ServletOutputStream getOutputStream() throws IOException {
145  0 return null;
146    }
147   
 
148  0 toggle public PrintWriter getWriter() throws IOException {
149  0 return this.writer;
150    }
151   
 
152  0 toggle public void setContentLength(int i) {
153    }
154   
 
155  14 toggle public void setContentType(String s) {
156  14 this.contentType = s;
157    }
158   
 
159  2 toggle public String getContentType() {
160  2 return this.contentType;
161    }
162   
 
163  0 toggle public void setBufferSize(int i) {
164    }
165   
 
166  0 toggle public int getBufferSize() {
167  0 return 0;
168    }
169   
 
170  0 toggle public void flushBuffer() throws IOException {
171    }
172   
 
173  0 toggle public void resetBuffer() {
174    }
175   
 
176  0 toggle public boolean isCommitted() {
177  0 return false;
178    }
179   
 
180  0 toggle public void reset() {
181    }
182   
 
183  0 toggle public void setLocale(Locale locale) {
184    }
185   
 
186  0 toggle public Locale getLocale() {
187  0 return null;
188    }
189   
 
190  0 toggle public void setCharacterEncoding(String s) {
191    //To change body of implemented methods use File | Settings | File Templates.
192    }
193   
194    }