22
33import static org .hamcrest .MatcherAssert .assertThat ;
44import static org .hamcrest .Matchers .greaterThan ;
5+ import static org .hamcrest .Matchers .greaterThanOrEqualTo ;
56import static org .junit .jupiter .api .Assertions .assertEquals ;
67import static org .junit .jupiter .api .Assertions .assertFalse ;
78import static org .junit .jupiter .api .Assertions .assertInstanceOf ;
@@ -148,8 +149,8 @@ public void roleMaster() {
148149 @ Test
149150 public void roleSlave () {
150151 EndpointConfig primaryEndpoint = HostAndPorts .getRedisEndpoint ("standalone0" );
151- EndpointConfig secondaryEndpoint = HostAndPorts . getRedisEndpoint (
152- "standalone4-replica-of-standalone1" );
152+ EndpointConfig secondaryEndpoint = HostAndPorts
153+ . getRedisEndpoint ( "standalone4-replica-of-standalone1" );
153154
154155 try (Jedis slave = new Jedis (secondaryEndpoint .getHostAndPort (),
155156 secondaryEndpoint .getClientConfigBuilder ().build ())) {
@@ -226,18 +227,18 @@ public void configGet() {
226227 Map <String , String > info = jedis .configGet ("m*" );
227228 assertNotNull (info );
228229 assertFalse (info .isEmpty ());
229- // assertTrue(info.size() % 2 == 0);
230+ // assertTrue(info.size() % 2 == 0);
230231 Map <byte [], byte []> infoBinary = jedis .configGet ("m*" .getBytes ());
231232 assertNotNull (infoBinary );
232233 assertFalse (infoBinary .isEmpty ());
233- // assertTrue(infoBinary.size() % 2 == 0);
234+ // assertTrue(infoBinary.size() % 2 == 0);
234235 }
235236
236237 @ Test
237238 public void configSet () {
238239 Map <String , String > info = jedis .configGet ("maxmemory" );
239- // assertEquals("maxmemory", info.get(0));
240- // String memory = info.get(1);
240+ // assertEquals("maxmemory", info.get(0));
241+ // String memory = info.get(1);
241242 String memory = info .get ("maxmemory" );
242243 assertNotNull (memory );
243244 assertEquals ("OK" , jedis .configSet ("maxmemory" , "200" ));
@@ -248,8 +249,8 @@ public void configSet() {
248249 public void configSetBinary () {
249250 byte [] maxmemory = SafeEncoder .encode ("maxmemory" );
250251 Map <byte [], byte []> info = jedis .configGet (maxmemory );
251- // assertArrayEquals(maxmemory, info.get(0));
252- // byte[] memory = info.get(1);
252+ // assertArrayEquals(maxmemory, info.get(0));
253+ // byte[] memory = info.get(1);
253254 byte [] memory = info .get (maxmemory );
254255 assertNotNull (memory );
255256 assertEquals ("OK" , jedis .configSet (maxmemory , Protocol .toByteArray (200 )));
@@ -259,13 +260,15 @@ public void configSetBinary() {
259260 @ Test
260261 @ SinceRedisVersion (value = "7.0.0" , message = "Starting with Redis version 7.0.0: Added the ability to pass multiple pattern parameters in one call" )
261262 public void configGetSetMulti () {
262- String [] params = new String []{"hash-max-listpack-entries" , "set-max-intset-entries" , "zset-max-listpack-entries" };
263+ String [] params = new String [] { "hash-max-listpack-entries" , "set-max-intset-entries" ,
264+ "zset-max-listpack-entries" };
263265 Map <String , String > info = jedis .configGet (params );
264266 assertEquals (3 , info .size ());
265267 assertEquals ("OK" , jedis .configSet (info ));
266268
267- byte [][] bparams = new byte [][]{SafeEncoder .encode ("hash-max-listpack-entries" ),
268- SafeEncoder .encode ("set-max-intset-entries" ), SafeEncoder .encode ("zset-max-listpack-entries" )};
269+ byte [][] bparams = new byte [][] { SafeEncoder .encode ("hash-max-listpack-entries" ),
270+ SafeEncoder .encode ("set-max-intset-entries" ),
271+ SafeEncoder .encode ("zset-max-listpack-entries" ) };
269272 Map <byte [], byte []> binfo = jedis .configGet (bparams );
270273 assertEquals (3 , binfo .size ());
271274 assertEquals ("OK" , jedis .configSetBinary (binfo ));
@@ -429,23 +432,23 @@ public void memoryUsageBinary() {
429432 // Note: It has been recommended not to base MEMORY USAGE test on exact value, as the response
430433 // may subject to be 'tuned' especially targeting a major Redis release.
431434
432- byte [] bfoo = {0x01 , 0x02 , 0x03 , 0x04 };
433- byte [] bbar = {0x05 , 0x06 , 0x07 , 0x08 };
434- byte [] bfoobar = {0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 };
435+ byte [] bfoo = { 0x01 , 0x02 , 0x03 , 0x04 };
436+ byte [] bbar = { 0x05 , 0x06 , 0x07 , 0x08 };
437+ byte [] bfoobar = { 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 };
435438
436439 jedis .set (bfoo , bbar );
437440 assertThat (jedis .memoryUsage (bfoo ), greaterThan (20l ));
438441
439- jedis .lpush (bfoobar , new byte []{ 0x01 , 0x02 }, new byte []{ 0x05 , 0x06 }, new byte []{ 0x00 });
440- assertThat (jedis .memoryUsage (bfoobar , 2 ), greaterThan (40l ));
442+ jedis .lpush (bfoobar , new byte [] { 0x01 , 0x02 }, new byte [] { 0x05 , 0x06 }, new byte [] { 0x00 });
443+ assertThat (jedis .memoryUsage (bfoobar , 2 ), greaterThanOrEqualTo (40l ));
441444
442445 assertNull (jedis .memoryUsage ("roo" , 2 ));
443446 }
444447
445448 @ Test
446449 public void memoryPurge () {
447- String memoryPurge = jedis .memoryPurge ();
448- assertNotNull (memoryPurge );
450+ String memoryPurge = jedis .memoryPurge ();
451+ assertNotNull (memoryPurge );
449452 }
450453
451454 @ Test
@@ -489,15 +492,16 @@ public void commandDocs() {
489492
490493 CommandDocument sortDoc = docs .get ("sort" );
491494 assertEquals ("generic" , sortDoc .getGroup ());
492- MatcherAssert .assertThat (sortDoc .getSummary (), Matchers . isOneOf (
493- "Sort the elements in a list, set or sorted set" ,
495+ MatcherAssert .assertThat (sortDoc .getSummary (),
496+ Matchers . isOneOf ( "Sort the elements in a list, set or sorted set" ,
494497 "Sorts the elements in a list, a set, or a sorted set, optionally storing the result." ));
495498 assertNull (sortDoc .getHistory ());
496499
497500 CommandDocument setDoc = docs .get ("set" );
498501 assertEquals ("1.0.0" , setDoc .getSince ());
499502 assertEquals ("O(1)" , setDoc .getComplexity ());
500- assertEquals ("2.6.12: Added the `EX`, `PX`, `NX` and `XX` options." , setDoc .getHistory ().get (0 ));
503+ assertEquals ("2.6.12: Added the `EX`, `PX`, `NX` and `XX` options." ,
504+ setDoc .getHistory ().get (0 ));
501505 }
502506
503507 @ Test
@@ -506,7 +510,8 @@ public void commandGetKeys() {
506510 List <String > keys = jedis .commandGetKeys ("SORT" , "mylist" , "ALPHA" , "STORE" , "outlist" );
507511 assertEquals (2 , keys .size ());
508512
509- List <KeyValue <String , List <String >>> keySandFlags = jedis .commandGetKeysAndFlags ("SET" , "k1" , "v1" );
513+ List <KeyValue <String , List <String >>> keySandFlags = jedis .commandGetKeysAndFlags ("SET" , "k1" ,
514+ "v1" );
510515 assertEquals ("k1" , keySandFlags .get (0 ).getKey ());
511516 assertEquals (2 , keySandFlags .get (0 ).getValue ().size ());
512517 }
@@ -581,17 +586,20 @@ public void commandList() {
581586 List <String > commands = jedis .commandList ();
582587 assertTrue (commands .size () > 100 );
583588
584- commands = jedis .commandListFilterBy (CommandListFilterByParams .commandListFilterByParams ().filterByModule ("JSON" ));
589+ commands = jedis .commandListFilterBy (
590+ CommandListFilterByParams .commandListFilterByParams ().filterByModule ("JSON" ));
585591 assertEquals (0 , commands .size ()); // json module was not loaded
586592
587- commands = jedis .commandListFilterBy (CommandListFilterByParams .commandListFilterByParams ().filterByAclCat ("admin" ));
593+ commands = jedis .commandListFilterBy (
594+ CommandListFilterByParams .commandListFilterByParams ().filterByAclCat ("admin" ));
588595 assertTrue (commands .size () > 10 );
589596
590- commands = jedis .commandListFilterBy (CommandListFilterByParams .commandListFilterByParams ().filterByPattern ("a*" ));
597+ commands = jedis .commandListFilterBy (
598+ CommandListFilterByParams .commandListFilterByParams ().filterByPattern ("a*" ));
591599 assertTrue (commands .size () > 10 );
592600
593- assertThrows (IllegalArgumentException .class , () ->
594- jedis .commandListFilterBy (CommandListFilterByParams .commandListFilterByParams ()));
601+ assertThrows (IllegalArgumentException .class ,
602+ () -> jedis .commandListFilterBy (CommandListFilterByParams .commandListFilterByParams ()));
595603 }
596604
597605 @ Test
0 commit comments