DATAREDIS-790 - Polishing.

Add unit tests.

Original Pull Request: #291.
Original ticket: DATAREDIS-714.
This commit is contained in:
Christoph Strobl
2018-01-12 09:13:37 +01:00
committed by Mark Paluch
parent 99b18c4ca5
commit ab5375802e

View File

@@ -258,6 +258,25 @@ public class JedisConnectionUnitTestSuite {
verify(jedisSpy, times(1)).quit();
}
@Test // DATAREDIS-714, DATAREDIS-790
public void doesNotSelectDbWhenCurrentDbMatchesDesiredOne() {
Jedis jedisSpy = spy(new MockedClientJedis("http://localhost:1234", getNativeRedisConnectionMock()));
new JedisConnection(jedisSpy);
verify(jedisSpy, never()).select(anyInt());
}
@Test // DATAREDIS-714, DATAREDIS-790
public void doesNotSelectDbWhenCurrentDbDoesNotMatchDesiredOne() {
Jedis jedisSpy = spy(new MockedClientJedis("http://localhost:1234", getNativeRedisConnectionMock()));
when(jedisSpy.getDB()).thenReturn(3L);
new JedisConnection(jedisSpy);
verify(jedisSpy).select(eq(0));
}
}
public static class JedisConnectionPipelineUnitTests extends JedisConnectionUnitTests {