File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/test/java/org/springframework/data/redis/connection/jedis Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,25 @@ public void hScanShouldCloseTheConnectionWhenCursorIsClosed() throws IOException
257
257
verify (jedisSpy , times (1 )).quit ();
258
258
}
259
259
260
+ @ Test // DATAREDIS-714
261
+ public void doesNotSelectDbWhenCurrentDbMatchesDesiredOne () {
262
+
263
+ Jedis jedisSpy = spy (new MockedClientJedis ("http://localhost:1234" , getNativeRedisConnectionMock ()));
264
+ new JedisConnection (jedisSpy );
265
+
266
+ verify (jedisSpy , never ()).select (anyInt ());
267
+ }
268
+
269
+ @ Test // DATAREDIS-714
270
+ public void doesNotSelectDbWhenCurrentDbDoesNotMatchDesiredOne () {
271
+
272
+ Jedis jedisSpy = spy (new MockedClientJedis ("http://localhost:1234" , getNativeRedisConnectionMock ()));
273
+ when (jedisSpy .getDB ()).thenReturn (3L );
274
+
275
+ new JedisConnection (jedisSpy );
276
+
277
+ verify (jedisSpy ).select (eq (0 ));
278
+ }
260
279
}
261
280
262
281
public static class JedisConnectionPipelineUnitTests extends JedisConnectionUnitTests {
You can’t perform that action at this time.
0 commit comments