public void testSisMember() throws ExecutionException, InterruptedException { String key = "SET_ADD_KEY2"; client.delete(key).get(); long reply = client.sadd(key, "OK", "KO").get(); assertEquals(2, reply); reply = client.sisMember(key, "OK").get(); assertEquals(1, reply); reply = client.sisMember(key, "OKO").get(); assertEquals(0, reply); }
public void testSpopAndRandomAndRem() throws ExecutionException, InterruptedException { String key1 = "SET_POP_KEY1"; client.delete(key1).get(); long reply = client.sadd(key1, "a", "b", "c", "d").get(); assertEquals(4, reply); String pop = (String) client.spop(key1).get(); assertNotNull(pop); reply = client.scard(key1).get(); assertEquals(3, reply); pop = (String) client.srandomMember(key1).get(); assertNotNull(pop); reply = client.scard(key1).get(); assertEquals(3, reply); List<String> randoms = (List<String>) client.srandomMember(key1, 2).get(); assertEquals(2, randoms.size()); reply = client.sadd(key1, "a", "b", "c", "d").get(); assertEquals(1, reply); reply = client.srem(key1, "a", "b").get(); assertEquals(2, reply); reply = client.sisMember(key1, "a").get(); assertEquals(0, reply); reply = client.sisMember(key1, "c").get(); assertEquals(1, reply); }