DATAREDIS-1013 - Polishing.

Add test. Consider grammar depending on argument count.

Original pull request: #468.
This commit is contained in:
Mark Paluch
2019-07-26 14:48:19 +02:00
parent c6267e7d47
commit 2de4141514
2 changed files with 13 additions and 8 deletions

View File

@@ -63,7 +63,7 @@ public class RedisCommandUnitTests {
assertThat(RedisCommand.failsafeCommandLookup("strangecommand")).isEqualTo(RedisCommand.UNKNOWN);
}
@Test // DATAREDIS-73, DATAREDIS-972
@Test // DATAREDIS-73, DATAREDIS-972, DATAREDIS-1013
public void shouldNotThrowExceptionOnValidArgumentCount() {
RedisCommand.AUTH.validateArgumentCount(1);
@@ -71,6 +71,7 @@ public class RedisCommandUnitTests {
RedisCommand.ZADD.validateArgumentCount(4);
RedisCommand.ZADD.validateArgumentCount(5);
RedisCommand.ZADD.validateArgumentCount(100);
RedisCommand.SELECT.validateArgumentCount(1);
}
@Test // DATAREDIS-822
@@ -85,16 +86,16 @@ public class RedisCommandUnitTests {
public void shouldReportArgumentMismatchIfMaxArgumentsExceeded() {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("BITPOS command requires at most 4 arguments");
expectedException.expectMessage("SELECT command requires 1 argument");
RedisCommand.BITPOS.validateArgumentCount(5);
RedisCommand.SELECT.validateArgumentCount(0);
}
@Test // DATAREDIS-73
public void shouldThrowExceptionOnInvalidArgumentCountWhenExpectedExactMatch() {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("AUTH command requires 1 arguments");
expectedException.expectMessage("AUTH command requires 1 argument");
RedisCommand.AUTH.validateArgumentCount(2);
}
@@ -103,7 +104,7 @@ public class RedisCommandUnitTests {
public void shouldThrowExceptionOnInvalidArgumentCountForDelWhenExpectedMinimalMatch() {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("DEL command requires at least 1 arguments");
expectedException.expectMessage("DEL command requires at least 1 argument");
RedisCommand.DEL.validateArgumentCount(0);
}