/**
  * Sets the Http session.
  *
  * @param session the session.
  */
 public void setSession(HttpSession session) {
   this.session = session;
   if (session instanceof MockHttpSession) {
     MockHttpSession mockSession = ((MockHttpSession) session);
     mockSession.access();
   }
 }
 /** @since 4.0 */
 @Test(expected = IllegalStateException.class)
 public void putValueOnInvalidatedSession() {
   session.invalidate();
   session.putValue("name", "value");
 }
 /** @since 4.0 */
 @Test(expected = IllegalStateException.class)
 public void getValueNamesOnInvalidatedSession() {
   session.invalidate();
   session.getValueNames();
 }
 /** @since 4.0 */
 @Test(expected = IllegalStateException.class)
 public void setAttributeOnInvalidatedSession() {
   session.invalidate();
   session.setAttribute("name", "value");
 }
 /** @since 4.0 */
 @Test(expected = IllegalStateException.class)
 public void getAttributeOnInvalidatedSession() {
   session.invalidate();
   session.getAttribute("foo");
 }
 /** @since 4.0 */
 @Test(expected = IllegalStateException.class)
 public void getLastAccessedTimeOnInvalidatedSession() {
   session.invalidate();
   session.getLastAccessedTime();
 }
 @Test(expected = IllegalStateException.class)
 public void invalidateTwice() {
   session.invalidate();
   session.invalidate();
 }
 @Test
 public void invalidateOnce() {
   assertFalse(session.isInvalid());
   session.invalidate();
   assertTrue(session.isInvalid());
 }
 /** @since 4.0 */
 @Test(expected = IllegalStateException.class)
 public void isNewOnInvalidatedSession() {
   session.invalidate();
   session.isNew();
 }