packer.write(e.getValue());
}
packer.writeMapEnd();
}
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
if (unpacker.trySkipNil()) {
assertEquals(null, v);
return;
}
int size = unpacker.readMapBegin();
Map<K, V> ret = new HashMap<K, V>(size);
for (int i = 0; i < size; ++i) {
K key = unpacker.read(keyElementClass);
V value = unpacker.read(valueElementClass);
ret.put(key, value);
}
unpacker.readMapEnd();
assertEquals(v.size(), ret.size());
for (Map.Entry<K, V> e : ((Map<K, V>) v).entrySet()) {
Object value = ret.get(e.getKey());
assertEquals(e.getValue(), value);
}