1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 package org.melati.servlet.test;
46
47 import java.util.Enumeration;
48 import java.util.Hashtable;
49
50 import javax.servlet.ServletContext;
51 import javax.servlet.http.HttpSession;
52 import javax.servlet.http.HttpSessionContext;
53
54
55
56
57
58
59 @SuppressWarnings("deprecation")
60 public class MockHttpSession implements HttpSession {
61
62 private Hashtable<String,Object> values;
63
64
65
66
67 public MockHttpSession() {
68 values = new Hashtable<String,Object>();
69 }
70
71
72
73
74
75 public Object getAttribute(String name) {
76 return values.get(name);
77 }
78
79
80
81
82
83 public Enumeration<String> getAttributeNames() {
84 throw new RuntimeException("TODO No one else has ever called this method."
85 + " Do you really want to start now?");
86
87 }
88
89
90
91
92
93 public long getCreationTime() {
94 throw new RuntimeException("TODO No one else has ever called this method."
95 + " Do you really want to start now?");
96
97 }
98
99
100
101
102
103 public String getId() {
104 return "1";
105 }
106
107
108
109
110
111 public long getLastAccessedTime() {
112 throw new RuntimeException("TODO No one else has ever called this method."
113 + " Do you really want to start now?");
114
115 }
116
117
118
119
120
121 public int getMaxInactiveInterval() {
122 throw new RuntimeException("TODO No one else has ever called this method."
123 + " Do you really want to start now?");
124
125 }
126
127
128
129
130
131 public ServletContext getServletContext() {
132 throw new RuntimeException("TODO No one else has ever called this method."
133 + " Do you really want to start now?");
134
135 }
136
137
138
139
140
141 public HttpSessionContext getSessionContext() {
142 throw new RuntimeException("TODO No one else has ever called this method."
143 + " Do you really want to start now?");
144 }
145
146
147
148
149
150 public Object getValue(String name) {
151 throw new RuntimeException("TODO No one else has ever called this method."
152 + " Do you really want to start now?");
153
154 }
155
156
157
158
159
160 public String[] getValueNames() {
161 throw new RuntimeException("TODO No one else has ever called this method."
162 + " Do you really want to start now?");
163
164 }
165
166
167
168
169
170 public void invalidate() {
171 throw new RuntimeException("TODO No one else has ever called this method."
172 + " Do you really want to start now?");
173
174 }
175
176
177
178
179
180 public boolean isNew() {
181 throw new RuntimeException("TODO No one else has ever called this method."
182 + " Do you really want to start now?");
183
184 }
185
186
187
188
189
190 public void putValue(String name, Object value) {
191 throw new RuntimeException("TODO No one else has ever called this method."
192 + " Do you really want to start now?");
193
194 }
195
196
197
198
199
200 public void removeAttribute(String name) {
201 values.remove(name);
202 }
203
204
205
206
207
208 public void removeValue(String name) {
209 throw new RuntimeException("TODO No one else has ever called this method."
210 + " Do you really want to start now?");
211
212 }
213
214
215
216
217
218 public void setAttribute(String name, Object value) {
219 values.put(name, value);
220 }
221
222
223
224
225
226 public void setMaxInactiveInterval(int interval) {
227 throw new RuntimeException("TODO No one else has ever called this method."
228 + " Do you really want to start now?");
229
230 }
231
232 }