RepositoryBackedSession { public boolean isExpired() { int maxInactiveInterval = sessionData.getMaxInactiveInterval(); if (maxInactiveInterval <= 0) { return false; } long instanceOfExpiring = sessionData.getLastAccessedTime() + TimeUnit.SECONDS.toMillis(maxInactiveInterval); return instanceOfExpiring < System.currentTimeMillis(); } RepositoryBackedSession(SessionData sessionData, SessionManager manager, SessionFactory factory); protected  RepositoryBackedSession(RepositoryBackedSession linked); void setMaxInactiveInterval(int maxInactiveInterval); Object getAttribute(String key); @SuppressWarnings({ "rawtypes" }) Enumeration getAttributeNames(); List<String> getAttributeNamesWithValues(); long getCreationTime(); String getId(); long getLastAccessedTime(); int getMaxInactiveInterval(); void invalidate(); void doInvalidate(boolean expired); boolean isNew(); void removeAttribute(String name); Attribute getAttributeFromCache(String name); void setAttribute(String key, Object value); synchronized void commit(); boolean isValid(); boolean isExpired(); boolean isDirty(); Runnable getCommitter(); SessionData getSessionData(); boolean isCommitted(); void setCommitted(boolean committed); SessionManager getSessionManager(); int getConcurrentUses();  }
@Test public void testIsNotExpired() { sessionData = new SessionData("1", System.currentTimeMillis(), 10); RepositoryBackedSession rbs = new RepositoryBackedSession(sessionData, manager, factory); assertFalse(rbs.isExpired()); }
@Test public void testNeverExpires() { SessionData sessionExpired = new SessionData("1", 200, 10); RepositoryBackedSession rbsExpired = new RepositoryBackedSession(sessionExpired, manager, factory); assertTrue(rbsExpired.isExpired()); SessionData sessionNotExpired = new SessionData("1", System.currentTimeMillis(), 10000); RepositoryBackedSession rbsNotExpired = new RepositoryBackedSession(sessionNotExpired, manager, factory); assertFalse(rbsNotExpired.isExpired()); SessionData sessionNeverExpires = new SessionData("2", 200, 0); RepositoryBackedSession rbsNeverExpires = new RepositoryBackedSession(sessionNeverExpires, manager, factory); assertFalse(rbsNeverExpires.isExpired()); }
@Test public void testIsExpired() { RepositoryBackedSession rbs = new RepositoryBackedSession(sessionData, manager, factory); assertTrue(rbs.isExpired()); }