- @Test
- fun `null is returned if no session exists`() {
- assertThat(request.existingSession, nullValue())
- }
-
- @Test
- fun `existing session can be retrieved`() {
- val session = mock<Session>()
- whenever(sessionManager.useSession(toadletContext)).thenReturn(session)
- assertThat(request.existingSession, sameInstance(session))
- }
-
- @Test
- fun `existing session is returned if it exists`() {
- val session = mock<Session>()
- whenever(sessionManager.useSession(toadletContext)).thenReturn(session)
- assertThat(request.session, sameInstance(session))
- }
-
- @Test
- fun `new session is returned if none exists`() {
- val session = mock<Session>()
- whenever(sessionManager.createSession(anyString(), ArgumentMatchers.eq(toadletContext))).thenReturn(session)
- assertThat(request.session, sameInstance(session))
- }
-