File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
main/java/org/springframework/data/redis/core
test/java/org/springframework/data/redis/core Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -257,8 +257,8 @@ public static RedisCommand failsafeCommandLookup(String key) {
257
257
private final boolean read ;
258
258
private final boolean write ;
259
259
260
- private final int minArgs ;
261
- private final int maxArgs ;
260
+ final int minArgs ;
261
+ final int maxArgs ;
262
262
263
263
private final @ Nullable String alias ;
264
264
@@ -313,7 +313,7 @@ public static RedisCommand failsafeCommandLookup(String key) {
313
313
* @return {@literal true} if the command requires arguments
314
314
*/
315
315
public boolean requiresArguments () {
316
- return minArgs >= 0 ;
316
+ return minArgs > 0 ;
317
317
}
318
318
319
319
/**
Original file line number Diff line number Diff line change 17
17
18
18
import static org .assertj .core .api .Assertions .*;
19
19
20
+ import java .util .Arrays ;
21
+
20
22
import org .junit .jupiter .api .Test ;
21
23
22
24
/**
@@ -117,4 +119,23 @@ void isRepresentedByIsCorrectForAllCommandsAndTheirAliases() {
117
119
}
118
120
}
119
121
}
122
+
123
+ @ Test // GH-2646
124
+ void commandRequiresArgumentsIsCorrect () {
125
+
126
+ Arrays .stream (RedisCommand .values ()).forEach (command ->
127
+ assertThat (command .requiresArguments ())
128
+ .describedAs ("Redis command [%s] failed required arguments check" , command )
129
+ .isEqualTo (command .minArgs > 0 ));
130
+ }
131
+
132
+ @ Test // GH-2646
133
+ void commandRequiresExactNumberOfArgumentsIsCorrect () {
134
+
135
+ Arrays .stream (RedisCommand .values ()).forEach (command ->
136
+ assertThat (command .requiresExactNumberOfArguments ())
137
+ .describedAs ("Redis command [%s] failed requires exact arguments check" )
138
+ .isEqualTo (command .minArgs == command .maxArgs ));
139
+ }
140
+
120
141
}
You can’t perform that action at this time.
0 commit comments