final String key = "foo:bar";
final Set<String> value = new LinkedHashSet<String>(Arrays.asList("foo", "bar", "baz"));
final long size = value.size();
final int offset = value.size() + 1;
final int count = value.size();
final KeyDAOPoolWork work = new KeyDAOPoolWork(key, offset, count);
this.mockCtx.checking(new Expectations(){{
oneOf(jedis).type(key); will(returnValue(KeyType.SET.toString()));
oneOf(jedis).scard(key); will(returnValue(size));
oneOf(jedis).smembers(key); will(returnValue(value));
}});
final KeyInfo keyInfo = work.doWork(this.jedis);
Assert.assertNotNull(keyInfo);
Assert.assertEquals("foo", keyInfo.getNamespace());
Assert.assertEquals("bar", keyInfo.getName());
Assert.assertEquals(KeyType.SET, keyInfo.getType());
Assert.assertEquals((Long) size, keyInfo.getSize());