### Question:
StatelessOperations implements SessionOperations { @Override public SessionInfo refresh(final Session session, final boolean reset) throws SessionException { final SessionInfo sessionInfo = statelessSessionFactory.getSessionInfo(session.getID()); if (sessionInfo.getExpiryTime() < System.currentTimeMillis()) { throw new SessionTimedOutException("Stateless session corresponding to client " + sessionInfo.getClientID() + " timed out."); } return sessionInfo; } @Inject  StatelessOperations(final LocalOperations localOperations,
                               final SessionService sessionService,
                               final StatelessSessionFactory statelessSessionFactory,
                               final SessionBlacklist sessionBlacklist,
                               final SessionLogging sessionLogging,
                               final SessionAuditor sessionAuditor); @Override SessionInfo refresh(final Session session, final boolean reset); @Override void logout(final Session session); @Override void destroy(final Session requester, final Session session); @Override void setProperty(final Session session, final String name, final String value);  }### Answer:
@Test public void shouldRefreshFromStatelessSessionFactory() throws Exception { SessionInfo info = new SessionInfo(); info.setExpiryTime(System.currentTimeMillis() + (1000 * 60 * 10)); given(mockSessionFactory.getSessionInfo(sid)).willReturn(info); SessionInfo result = statelessOperations.refresh(mockSession, false); verify(mockSessionFactory).getSessionInfo(sid); assertThat(result).isSameAs(info); }
@Test(expectedExceptions = SessionTimedOutException.class) public void refreshShouldTimeoutFromStatelessSessionFactory() throws Exception { SessionInfo info = new SessionInfo(); given(mockSessionFactory.getSessionInfo(sid)).willReturn(info); SessionInfo result = statelessOperations.refresh(mockSession, false); }