### Question:
RedisStore extends AbstractLifecycle implements RedisStoreManagement, Store { @Override public void clear() { this.lockTemplate.withReadLock(new LockTemplate.LockedOperation<Void>() { @Override public Void invoke() { try { RedisStore.this.jedisClient.clean(getSessionKeyPrefix()); } catch (JedisConnectionException e) { RedisStore.this.logger.error("Unable to clear persisted sessions", e); } return null; } }); } RedisStore();   RedisStore(JmxSupport jmxSupport, PropertyChangeSupport propertyChangeSupport,
               SessionSerializationUtils sessionSerializationUtils, JedisClient jedisClient); @Override void addPropertyChangeListener(PropertyChangeListener propertyChangeListener); @Override void clear(); @Override int getConnectionPoolSize(); void setConnectionPoolSize(final int connectionPoolSize); @Override int getDatabase(); void setDatabase(final int database); @Override String getSessionKeyPrefix(); void setSessionKeyPrefix(final String sessionKeyPrefix); @Override String getHost(); void setHost(final String host); @Override Manager getManager(); @Override void setManager(final Manager manager); @Override String getPassword(); void setPassword(final String password); @Override int getPort(); void setPort(final int port); @Override int getSize(); @Override int getTimeout(); void setTimeout(final int timeout); @Override String getUri(); @Override boolean getCluster(); void setCluster(final boolean cluster); void setUri(final String uri); @Override String[] keys(); @Override Session load(final String id); @Override void remove(final String id); @Override void removePropertyChangeListener(PropertyChangeListener propertyChangeListener); @Override void save(final Session session); static final int DEFAULT_SO_TIMEOUT; }### Answer:
@Test public void clear() throws IOException { Set<String> sessionIds = new HashSet<>(); sessionIds.add("test-id"); when(this.jedisClient.getSessions(SESSIONS_KEY)).thenReturn(sessionIds); this.store.clear(); verify(this.jedisClient).clean(SESSIONS_KEY); }
@Test public void clearJedisConnectionException() { doThrow(new JedisConnectionException("test-message")) .when(this.jedisClient) .clean(SESSIONS_KEY); this.store.clear(); }