RedisSessionRepository implements SessionRepository { @Override public boolean prepareRemove(SessionData session) { Long result = redis.hsetnx(sessionKey(session.getId()), INVALID_SESSION, BYTES_TRUE); return result.intValue() == 1; } RedisSessionRepository(RedisFacade redis, String namespace, String owner, ExpirationStrategy strategy,
      boolean sticky); @Override void setSessionManager(final SessionManager sessionManager); @Override SessionData getSessionData(String id); @Override CommitTransaction startCommit(SessionData session); @Override void remove(SessionData session); byte[] sessionKey(String sessionId); @Override Object getSessionAttribute(SessionData session, String attribute); @Override boolean prepareRemove(SessionData session); @Override Set<String> getAllKeys(SessionData session); @Override void storeSessionData(SessionData sessionData); @Override void requestFinished(); @Override void setSessionAttribute(SessionData session, String name, Object value); @Override void removeSessionAttribute(SessionData session, String name); @Override boolean cleanSessionsOnShutdown(); @Override Collection<String> getOwnedSessionIds(); @Override void close(); @Override void reset(); @Override void sessionIdChange(SessionData sessionData); @Override boolean isConnected();  }
@Test public void testPrepareRemove() { RedisFacade facade = mock(RedisFacade.class); try (RedisSessionRepository rsr = new RedisSessionRepository(facade, "myapp", "localhost", ExpirationStrategy.ZRANGE, false)) { byte[] key = new byte[] { 35, 58, 105, 110, 118, 97, 108, 105, 100, 83, 101, 115, 115, 105, 111, 110 }; byte[] value = RedisSessionRepository.BYTES_TRUE; Map<byte[], byte[]> result = new HashMap<>(); result.put(key, value); rsr.prepareRemove(new SessionData("401", 100, 10)); verify(facade, times(1)).hsetnx(argThat(matchesArray(rsr.sessionKey("401"))), argThat(matchesArray(key)), argThat(matchesArray(value))); } }