### Question:
RedisStore extends AbstractLifecycle implements RedisStoreManagement, Store { @Override public int getSize() { return this.lockTemplate.withReadLock(new LockTemplate.LockedOperation<Integer>() { @Override public Integer invoke() { try { return RedisStore.this.jedisClient.count(getSessionKeyPrefix()); } catch (JedisConnectionException e) { RedisStore.this.logger.error("Unable to get the number of persisted sessions", e); return Integer.MIN_VALUE; } } }); } 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 getSize() throws IOException { when(this.jedisClient.count(SESSIONS_KEY)).thenReturn(Integer.MAX_VALUE); int result = this.store.getSize(); assertEquals(Integer.MAX_VALUE, result); }
@Test public void getSizeJedisConnectionException() { doThrow(new JedisConnectionException("test-message")) .when(this.jedisClient) .count(SESSIONS_KEY); int result = this.store.getSize(); assertEquals(Integer.MIN_VALUE, result); }