Skip to content

Commit

Permalink
test for UNWATCH in pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Jul 23, 2019
1 parent a68a8f1 commit 251b532
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/java/redis/clients/jedis/tests/PipeliningTest.java
Expand Up @@ -308,6 +308,24 @@ public void multiWithSync() {
assertEquals("world", r3.get());
}

@Test
public void multiWithWatch() {
String key = "foo";
String val = "bar";
List<Object> expect = new ArrayList<>();
List<Object> expMulti = new ArrayList<>();

Pipeline pipe = jedis.pipelined();
pipe.set(key, val); expect.add("OK");
pipe.watch(key); expect.add("OK");
pipe.multi(); expect.add("OK");
pipe.unwatch(); expect.add("QUEUED"); expMulti.add("OK");
pipe.get(key); expect.add("QUEUED"); expMulti.add(val);
pipe.exec(); expect.add(expMulti);

assertEquals(expect, pipe.syncAndReturnAll());
}

@Test(expected = JedisDataException.class)
public void pipelineExecShoudThrowJedisDataExceptionWhenNotInMulti() {
Pipeline pipeline = jedis.pipelined();
Expand Down

0 comments on commit 251b532

Please sign in to comment.