packer.write(e.getValue());
}
packer.writeMapEnd();
}
byte[] bytes = out.toByteArray();
Unpacker unpacker = msgpack.createBufferUnpacker(bytes);
if (unpacker.trySkipNil()) {
assertEquals(null, v);
return;
}
int size = unpacker.readMapBegin();
Map ret = new HashMap(size);
for (int i = 0; i < size; ++i) {
Object key = unpacker.read(keyElementClass);
Object value = unpacker.read(valueElementClass);
ret.put(key, value);
}
unpacker.readMapEnd();
assertEquals(v.size(), ret.size());
for (Map.Entry<Object, Object> e : ((Map<Object, Object>) v).entrySet()) {
Object value = ret.get(e.getKey());
assertEquals(e.getValue(), value);
}