@Test
    public void testHitCollection() throws IOException {
        try (SerializationTester t = new SerializationTester("testHitCollection")) {
            t.assertMatch(new FS4Hit(0, new GlobalId(new byte[GlobalId.LENGTH]), 0, -1));
            t.assertMatch(new FS4Hit(0, createGlobalId(100), 50.0, -1));
            t.assertMatch(new VdsHit());
            //TODO Verify the two structures below
            t.assertMatch(new VdsHit("100", new byte[0], 50.0));
            t.assertMatch(new VdsHit("100", "rawsummary".getBytes(), 50.0));
            t.assertMatch(new HitsAggregationResult());
            t.assertMatch(new HitsAggregationResult()
                    .setMaxHits(5)
                    .addHit(new FS4Hit(0, createGlobalId(10), 1.0, -1))
                    .addHit(new FS4Hit(0, createGlobalId(20), 2.0, -1))
                    .addHit(new FS4Hit(0, createGlobalId(30), 3.0, -1))
                    .addHit(new FS4Hit(0, createGlobalId(40), 4.0, -1))
                    .addHit(new FS4Hit(0, createGlobalId(50), 5.0, -1))
                    .setExpression(new ConstantNode(new IntegerResultNode(5))));
            t.assertMatch(new HitsAggregationResult()
                    .setMaxHits(3)
                    .addHit(new FS4Hit(0, createGlobalId(10), 1.0, 100))
                    .addHit(new FS4Hit(0, createGlobalId(20), 2.0, 200))
                    .addHit(new FS4Hit(0, createGlobalId(30), 3.0, 300))
                    .setExpression(new ConstantNode(new IntegerResultNode(5))));
            //TODO Verify content
            t.assertMatch(new HitsAggregationResult()
                    .setMaxHits(3)
                    .addHit(new VdsHit("10", "100".getBytes(), 1.0))
                    .addHit(new VdsHit("20", "200".getBytes(), 2.0))
                    .addHit(new VdsHit("30", "300".getBytes(), 3.0))
                    .setExpression(new ConstantNode(new IntegerResultNode(5))));
        }
    }
Tests serialization compatibility across Java and C++. The comparison is performed by comparing serialized Java
object graphs with the content of specific binary files. C++ unit tests serializes
identical data structures into these files.
Note: This test relies heavily on proper implementation of {@link Object#equals(Object)}!
searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingSerializationTest.java