Skip to content

Commit

Permalink
Updated RedisClientTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
SanHalacogluImproving committed Feb 27, 2024
1 parent 84fb9f9 commit 6aea6ac
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions java/client/src/test/java/glide/api/RedisClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -883,6 +884,7 @@ public void zadd_withOptions_returns_success() {
String key = "testKey";
ZaddOptions options =
ZaddOptions.builder()
.conditionalChange(ZaddOptions.ConditionalChange.ONLY_IF_EXISTS)
.updateOptions(ZaddOptions.UpdateOptions.SCORE_GREATER_THAN_CURRENT)
.build();
Map<String, Double> membersScores = new LinkedHashMap<>();
Expand All @@ -909,6 +911,24 @@ public void zadd_withOptions_returns_success() {
assertEquals(value, payload);
}

@SneakyThrows
@Test
public void zadd_withIllegalArgument_throws_exception() {
// setup
String key = "testKey";
ZaddOptions options =
ZaddOptions.builder()
.conditionalChange(ZaddOptions.ConditionalChange.ONLY_IF_DOES_NOT_EXIST)
.updateOptions(ZaddOptions.UpdateOptions.SCORE_GREATER_THAN_CURRENT)
.build();
Map<String, Double> membersScores = new LinkedHashMap<>();
membersScores.put("testMember1", 1.0);
membersScores.put("testMember2", 2.0);

assertThrows(
IllegalArgumentException.class, () -> service.zadd(key, membersScores, options, false));
}

@SneakyThrows
@Test
public void zaddIncr_noOptions_returns_success() {
Expand Down

0 comments on commit 6aea6ac

Please sign in to comment.