This is an automated email from the ASF dual-hosted git repository.
lprimak pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/main by this push:
new d1013d660 bugfix(test): don't use private fields in tests
d1013d660 is described below
commit d1013d660d03b02afabbe438fffbc4acfeb683a9
Author: lprimak <[email protected]>
AuthorDate: Tue Jan 27 22:49:02 2026 -0600
bugfix(test): don't use private fields in tests
---
.../session/mgt/ServletContainerSessionManagerTest.groovy | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git
a/web/src/test/groovy/org/apache/shiro/web/session/mgt/ServletContainerSessionManagerTest.groovy
b/web/src/test/groovy/org/apache/shiro/web/session/mgt/ServletContainerSessionManagerTest.groovy
index ed58e2110..1cf601a07 100644
---
a/web/src/test/groovy/org/apache/shiro/web/session/mgt/ServletContainerSessionManagerTest.groovy
+++
b/web/src/test/groovy/org/apache/shiro/web/session/mgt/ServletContainerSessionManagerTest.groovy
@@ -33,6 +33,8 @@ import static org.junit.jupiter.api.Assertions.*
* Unit tests for the {@link ServletContainerSessionManager} implementation.
*/
class ServletContainerSessionManagerTest {
+ private final String HOST_SESSION_KEY = HttpServletSession.class.getName()
+ ".HOST_SESSION_KEY";
+ private final String TOUCH_OBJECT_SESSION_KEY =
HttpServletSession.class.getName() + ".TOUCH_OBJECT_SESSION_KEY";
@Test
void testStartWithNonWebSessionContext() {
@@ -66,8 +68,8 @@ class ServletContainerSessionManagerTest {
expect(request.session).andReturn httpSession
- httpSession.setAttribute(eq(HttpServletSession.HOST_SESSION_KEY),
eq(host))
-
expect(httpSession.getAttribute(eq(HttpServletSession.HOST_SESSION_KEY))).andReturn
host
+ httpSession.setAttribute(eq(HOST_SESSION_KEY), eq(host))
+ expect(httpSession.getAttribute(eq(HOST_SESSION_KEY))).andReturn host
replay request, response, httpSession
@@ -96,8 +98,8 @@ class ServletContainerSessionManagerTest {
expect(request.session).andReturn httpSession
expect(request.remoteHost).andReturn host
- httpSession.setAttribute(eq(HttpServletSession.HOST_SESSION_KEY),
eq(host))
-
expect(httpSession.getAttribute(eq(HttpServletSession.HOST_SESSION_KEY))).andReturn
host
+ httpSession.setAttribute(eq(HOST_SESSION_KEY), eq(host))
+ expect(httpSession.getAttribute(eq(HOST_SESSION_KEY))).andReturn host
replay request, response, httpSession
@@ -139,8 +141,8 @@ class ServletContainerSessionManagerTest {
expect(request.getSession(false)).andReturn httpSession
expect(request.remoteHost).andReturn host
- httpSession.setAttribute(eq(HttpServletSession.HOST_SESSION_KEY),
eq(host))
-
expect(httpSession.getAttribute(eq(HttpServletSession.HOST_SESSION_KEY))).andReturn
host
+ httpSession.setAttribute(eq(HOST_SESSION_KEY), eq(host))
+ expect(httpSession.getAttribute(eq(HOST_SESSION_KEY))).andReturn host
def key = new WebSessionKey(request, response)