@@ -131,6 +131,18 @@ public abstract class AbstractConnectionIntegrationTests {
131
131
132
132
protected RedisConnection byteConnection ;
133
133
134
+ private boolean isJedisOrLettuceConnection (RedisConnectionFactory connectionFactory ) {
135
+ return ConnectionUtils .isJedis (connectionFactory ) || ConnectionUtils .isLettuce (connectionFactory );
136
+ }
137
+
138
+ private boolean isNotJedisOrLettuceConnection (RedisConnectionFactory connectionFactory ) {
139
+ return !isJedisOrLettuceConnection (connectionFactory );
140
+ }
141
+
142
+ private boolean isPipelinedOrQueueingConnection (RedisConnection connection ) {
143
+ return connection .isPipelined () || connection .isQueueing ();
144
+ }
145
+
134
146
@ BeforeEach
135
147
public void setUp () {
136
148
@@ -2595,12 +2607,12 @@ public void testListClientsContainsAtLeastOneElement() {
2595
2607
@ Test // DATAREDIS-290
2596
2608
void scanShouldReadEntireValueRange () {
2597
2609
2598
- if (! ConnectionUtils . isJedis ( connectionFactory ) && ! ConnectionUtils . isLettuce (connectionFactory )) {
2610
+ if (isNotJedisOrLettuceConnection (connectionFactory )) {
2599
2611
throw new AssumptionViolatedException ("SCAN is only available for jedis and lettuce" );
2600
2612
}
2601
2613
2602
- if (connection . isPipelined () || connection . isQueueing ( )) {
2603
- throw new AssumptionViolatedException ("SCAN is only available in non pipeline | queue mode" );
2614
+ if (isPipelinedOrQueueingConnection ( connection )) {
2615
+ throw new AssumptionViolatedException ("SCAN is only available in non- pipeline | non-queueing mode" );
2604
2616
}
2605
2617
2606
2618
connection .set ("spring" , "data" );
@@ -2626,8 +2638,9 @@ void scanShouldReadEntireValueRange() {
2626
2638
@ EnabledOnRedisVersion ("6.0" )
2627
2639
void scanWithType () {
2628
2640
2629
- assumeThat (connection .isPipelined () || connection .isQueueing ())
2630
- .describedAs ("SCAN is only available in non pipeline | queue mode" ).isFalse ();
2641
+ assumeThat (isPipelinedOrQueueingConnection (connection ))
2642
+ .describedAs ("SCAN is only available in non-pipeline | non-queueing mode" )
2643
+ .isFalse ();
2631
2644
2632
2645
connection .set ("key" , "data" );
2633
2646
connection .lPush ("list" , "foo" );
@@ -2670,11 +2683,11 @@ public void scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmpty
2670
2683
@ Test // DATAREDIS-306
2671
2684
void zScanShouldReadEntireValueRange () {
2672
2685
2673
- if (! ConnectionUtils . isJedis ( connectionFactory ) && ! ConnectionUtils . isLettuce (connectionFactory )) {
2686
+ if (isNotJedisOrLettuceConnection (connectionFactory )) {
2674
2687
throw new AssumptionViolatedException ("ZSCAN is only available for jedis and lettuce" );
2675
2688
}
2676
2689
2677
- if (connection . isPipelined () || connection . isQueueing ( )) {
2690
+ if (isPipelinedOrQueueingConnection ( connection )) {
2678
2691
throw new AssumptionViolatedException ("ZSCAN is only available in non pipeline | queue mode" );
2679
2692
}
2680
2693
@@ -2701,11 +2714,11 @@ void zScanShouldReadEntireValueRange() {
2701
2714
@ Test // DATAREDIS-304
2702
2715
void sScanShouldReadEntireValueRange () {
2703
2716
2704
- if (! ConnectionUtils . isJedis ( connectionFactory ) && ! ConnectionUtils . isLettuce (connectionFactory )) {
2717
+ if (isNotJedisOrLettuceConnection (connectionFactory )) {
2705
2718
throw new AssumptionViolatedException ("SCAN is only available for jedis and lettuce" );
2706
2719
}
2707
2720
2708
- if (connection . isPipelined () || connection . isQueueing ( )) {
2721
+ if (isPipelinedOrQueueingConnection ( connection )) {
2709
2722
throw new AssumptionViolatedException ("SCAN is only available in non pipeline | queue mode" );
2710
2723
}
2711
2724
@@ -2726,11 +2739,11 @@ void sScanShouldReadEntireValueRange() {
2726
2739
@ Test // DATAREDIS-305
2727
2740
void hScanShouldReadEntireValueRange () {
2728
2741
2729
- if (! ConnectionUtils . isJedis ( connectionFactory ) && ! ConnectionUtils . isLettuce (connectionFactory )) {
2742
+ if (isNotJedisOrLettuceConnection (connectionFactory )) {
2730
2743
throw new AssumptionViolatedException ("HSCAN is only available for jedis and lettuce" );
2731
2744
}
2732
2745
2733
- if (connection . isPipelined () || connection . isQueueing ( )) {
2746
+ if (isPipelinedOrQueueingConnection ( connection )) {
2734
2747
throw new AssumptionViolatedException ("HSCAN is only available in non pipeline | queue mode" );
2735
2748
}
2736
2749
0 commit comments