1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
34
34
/**
35
35
* Mock implementation of the {@link javax.servlet.http.HttpSession} interface.
36
36
*
37
- * <p>As of Spring 4.0, this set of mocks is designed on a Servlet 3.0 baseline.
38
- *
39
- * <p>Used for testing the web framework; also useful for testing application
40
- * controllers.
37
+ * <p>As of Spring 5.0, this set of mocks is designed on a Servlet 4.0 baseline.
41
38
*
42
39
* @author Juergen Hoeller
43
40
* @author Rod Johnson
@@ -72,7 +69,6 @@ public class MockHttpSession implements HttpSession {
72
69
73
70
/**
74
71
* Create a new MockHttpSession with a default {@link MockServletContext}.
75
- *
76
72
* @see MockServletContext
77
73
*/
78
74
public MockHttpSession () {
@@ -81,7 +77,6 @@ public MockHttpSession() {
81
77
82
78
/**
83
79
* Create a new MockHttpSession.
84
- *
85
80
* @param servletContext the ServletContext that the session runs in
86
81
*/
87
82
public MockHttpSession (ServletContext servletContext ) {
@@ -90,7 +85,6 @@ public MockHttpSession(ServletContext servletContext) {
90
85
91
86
/**
92
87
* Create a new MockHttpSession.
93
- *
94
88
* @param servletContext the ServletContext that the session runs in
95
89
* @param id a unique identifier for this session
96
90
*/
@@ -99,6 +93,7 @@ public MockHttpSession(ServletContext servletContext, String id) {
99
93
this .id = (id != null ? id : Integer .toString (nextId ++));
100
94
}
101
95
96
+
102
97
@ Override
103
98
public long getCreationTime () {
104
99
assertIsValid ();
@@ -111,8 +106,8 @@ public String getId() {
111
106
}
112
107
113
108
/**
114
- * As of Servlet 3.1 the id of a session can be changed.
115
- * @return the new session id.
109
+ * As of Servlet 3.1, the id of a session can be changed.
110
+ * @return the new session id
116
111
* @since 4.0.3
117
112
*/
118
113
public String changeSessionId () {
@@ -227,7 +222,6 @@ public void clearAttributes() {
227
222
228
223
/**
229
224
* Invalidates this session then unbinds any objects bound to it.
230
- *
231
225
* @throws IllegalStateException if this method is called on an already invalidated session
232
226
*/
233
227
@ Override
@@ -244,7 +238,6 @@ public boolean isInvalid() {
244
238
/**
245
239
* Convenience method for asserting that this session has not been
246
240
* {@linkplain #invalidate() invalidated}.
247
- *
248
241
* @throws IllegalStateException if this session has been invalidated
249
242
*/
250
243
private void assertIsValid () {
@@ -264,7 +257,6 @@ public boolean isNew() {
264
257
/**
265
258
* Serialize the attributes of this session into an object that can be
266
259
* turned into a byte array with standard Java serialization.
267
- *
268
260
* @return a representation of this session's serialized state
269
261
*/
270
262
public Serializable serializeState () {
@@ -291,7 +283,6 @@ public Serializable serializeState() {
291
283
/**
292
284
* Deserialize the attributes of this session from a state object created by
293
285
* {@link #serializeState()}.
294
- *
295
286
* @param state a representation of this session's serialized state
296
287
*/
297
288
@ SuppressWarnings ("unchecked" )
0 commit comments