@Test
public void testSortedSetExpiration() {

  RedisFacade facade = mock(RedisFacade.class);
  try (RedisSessionRepository rsr = new RedisSessionRepository(facade, "myapp", "localhost", ExpirationStrategy.ZRANGE, false)) {
    SessionConfiguration conf = new SessionConfiguration();
    SessionManager sm = mock(SessionManager.class);
    when(sm.getConfiguration()).thenReturn(conf);
    rsr.setSessionManager(sm);
    verify(sm).schedule(any(String.class), any(Runnable.class), eq(10L));
    conf.setMaxInactiveInterval(10);
    sm = mock(SessionManager.class);
    when(sm.getConfiguration()).thenReturn(conf);
    rsr.setSessionManager(sm);
    verify(sm).schedule(any(String.class), any(Runnable.class), eq(2L));
    sm = mock(SessionManager.class);
    when(sm.getConfiguration()).thenReturn(conf);
    conf.setMaxInactiveInterval(-100);
    rsr.setSessionManager(sm);
    verify(sm).schedule(any(String.class), any(Runnable.class), eq(10L));
  }
}