@Override
        public void close() throws IOException {
            if (UPDATE_SPEC) {
                out.close();
                return;
            }
            int bytesLeft = 0;
            while (in.read() != -1)
                bytesLeft++;
            in.close();
            if (bytesLeft > 0)
                fail(FILE_PATH + "/" + fileName + " has " + bytesLeft + " bytes left. " +
                     "Did you forget to deserialize an object on Java side?");
        }
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