コード例 #1
0
 @Test
 public void testSessionAttributes_whenSesessionHasSomeAttributesAndDoesNotHaveSome()
     throws Exception {
   when(request.getSession(false)).thenReturn(session);
   when(session.getAttribute("valid1")).thenReturn("validvalue1");
   assertThat(
       Traceables.sessionAttrs(request, "valid1", "invalid1").asString(),
       is(equalTo("HttpSession.attrs: [[{valid1=validvalue1, invalid1=null}]]")));
 }
コード例 #2
0
 @Test
 public void testSessionAttributes_whenSessionIsNull() throws Exception {
   when(request.getSession(false)).thenReturn(null);
   assertThat(Traceables.sessionAttrs(request).asString(), is(equalTo("[null - HttpSession]")));
 }
コード例 #3
0
 @Test
 public void testSessionAttributes() throws Exception {
   assertThat(
       Traceables.sessionAttrs(null).asString(),
       is(equalTo("[Unable to getSession - null HttpServletRequest]")));
 }