Fix broken U tests

This commit is contained in:
Yaourt
2010-11-04 17:14:06 +01:00
parent e2d8148802
commit fd8e3116ab
3 changed files with 71 additions and 19 deletions

View File

@@ -1,10 +1,12 @@
package redis.clients.jedis.tests;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.Assert;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisShardInfo;
import redis.clients.jedis.Protocol;
@@ -41,4 +43,26 @@ public class JedisTest extends JedisCommandTestBase {
Jedis jedis = new Jedis(shardInfo);
jedis.get("foo");
}
@SuppressWarnings("rawtypes")
public static void compareList(List expected, List result) {
final Iterator expectedit = expected.iterator();
final Iterator responseit = result.iterator();
while(expectedit.hasNext()) {
final Object exp = expectedit.next();
final Object resp = responseit.next();
if(exp instanceof byte[]) {
final byte[] bexp = (byte[]) exp;
final byte[] bresp = (byte[]) resp;
Assert.assertArrayEquals(bexp, bresp);
} else if (exp instanceof List) {
final List subexp = (List) exp;
final List subresp = (List) resp;
compareList(subexp, subresp);
} else {
assertEquals(exp, resp);
}
}
}
}