File tree 1 file changed +6
-8
lines changed
src/test/java/redis/clients/jedis
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 19
19
import org .junit .jupiter .api .Test ;
20
20
import org .junit .jupiter .api .extension .RegisterExtension ;
21
21
import redis .clients .jedis .exceptions .InvalidURIException ;
22
+ import redis .clients .jedis .exceptions .JedisAccessControlException ;
22
23
import redis .clients .jedis .exceptions .JedisException ;
23
24
import redis .clients .jedis .util .RedisVersionCondition ;
24
25
@@ -273,14 +274,11 @@ public void testCloseConnectionOnMakeObject() {
273
274
Jedis jedis = new Jedis (endpointWithDefaultUser .getURIBuilder ()
274
275
.credentials ("" , endpointWithDefaultUser .getPassword ()).build ())) {
275
276
int currentClientCount = getClientCount (jedis .clientList ());
276
- try {
277
- pool .getResource ();
278
- fail ("Should throw exception as password is incorrect." );
279
- } catch (Exception e ) {
280
- await ().pollDelay (Duration .ofMillis (10 )).atMost (50 , MILLISECONDS )
281
- .until (() -> getClientCount (jedis .clientList ()) == currentClientCount );
282
- assertEquals (currentClientCount , getClientCount (jedis .clientList ()));
283
- }
277
+ assertThrows (JedisAccessControlException .class , pool ::getResource );
278
+ // wait for the redis server to close the connection
279
+ await ().pollDelay (Duration .ofMillis (10 )).atMost (50 , MILLISECONDS )
280
+ .until (() -> getClientCount (jedis .clientList ()) == currentClientCount );
281
+ assertEquals (currentClientCount , getClientCount (jedis .clientList ()));
284
282
}
285
283
}
286
284
You can’t perform that action at this time.
0 commit comments