final Set<String> valueKeys = new LinkedHashSet<String>(Arrays.asList("foo", "bar", "baz"));
final List<String> valueValues = Arrays.asList("789");
final long size = valueKeys.size();
final int offset = valueKeys.size() - 1;
final int count = valueKeys.size();
final KeyDAOPoolWork work = new KeyDAOPoolWork(key, offset, count);
this.mockCtx.checking(new Expectations(){{
oneOf(jedis).type(key); will(returnValue(KeyType.HASH.toString()));
oneOf(jedis).hlen(key); will(returnValue(size));
oneOf(jedis).hkeys(key); will(returnValue(valueKeys));
oneOf(jedis).hmget(key, "baz"); will(returnValue(valueValues));
}});
final KeyInfo keyInfo = work.doWork(this.jedis);
Assert.assertNotNull(keyInfo);
Assert.assertEquals("foo", keyInfo.getNamespace());
Assert.assertEquals("bar", keyInfo.getName());
Assert.assertEquals(KeyType.HASH, keyInfo.getType());
Assert.assertEquals((Long) size, keyInfo.getSize());