testSerializingSlicedDistinctFacet(counts, expectedCounts, expectedCards);
}
private void testSerializingSlicedDistinctFacet(final ExtTLongObjectHashMap<ExtTHashMap<BytesRef, DistinctCountPayload>> counts,
final Map<Long, Map<BytesRef, Integer>> expectedCounts, final Map<Long, Map<BytesRef, Integer>> expectedCards) throws Exception {
final InternalSlicedDistinctFacet toSend = new InternalSlicedDistinctFacet("baz", counts);
final InternalSlicedDistinctFacet toReceive = new InternalSlicedDistinctFacet();
serializeAndDeserialize(toSend, toReceive);
final ExtTLongObjectHashMap<ExtTHashMap<BytesRef, DistinctCountPayload>> receivedCounts =
new ExtTLongObjectHashMap<ExtTHashMap<BytesRef, DistinctCountPayload>>(toReceive.peekCounts());
// Check against original counts as sentCounts may have been recycled
compareSlicedDistinctCounts(expectedCounts, expectedCards, receivedCounts);
}