fixing Issue 188

This commit is contained in:
Vladimir Soskov
2011-07-31 19:50:16 -07:00
parent 6c3ec9fc14
commit 22d4d3fc53
6 changed files with 87 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;
import redis.clients.jedis.Response;
import redis.clients.jedis.Transaction;
import redis.clients.jedis.TransactionBlock;
@@ -241,4 +242,39 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
string.get();
t.exec();
}
@Test
public void transactionResponseWithError() {
Transaction t = jedis.multi();
t.set("foo", "bar");
Response<Set<String>> error = t.smembers("foo");
Response<String> r = t.get("foo");
List<Object> l = t.exec();
assertEquals(JedisDataException.class, l.get(1).getClass());
try{
error.get();
fail("We expect exception here!");
}catch(JedisDataException e){
//that is fine we should be here
}
assertEquals(r.get(), "bar");
}
@Test
public void execGetResponse() {
Transaction t = jedis.multi();
t.set("foo", "bar");
t.smembers("foo");
t.get("foo");
List<Response<?>> lr = t.execGetResponse();
try{
lr.get(1).get();
fail("We expect exception here!");
}catch(JedisDataException e){
//that is fine we should be here
}
assertEquals("bar", lr.get(2).get());
}
}