This is an automated email from the ASF dual-hosted git repository.
lprimak pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/3.x by this push:
new a9a260aa0 bugfix(test): don't use private fields in tests
a9a260aa0 is described below
commit a9a260aa030a2247aedb41fc8fae1e717cd73696
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 f1bb4a889..49e41d549 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)