public static void assertSerializationMatchesCpp(String binaryFilesFolder, String fileName,
                                                     Document document, TestDocumentFactory factory) throws IOException {
        byte[] buf = serializeDocument(document);
        Files.write(Paths.get(binaryFilesFolder, fileName + "__java.new"), buf,
                    StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);
        Files.move(Paths.get(binaryFilesFolder, fileName + "__java.new"),
                   Paths.get(binaryFilesFolder, fileName + "__java"), StandardCopyOption.ATOMIC_MOVE);

        assertDeserializeFromFile(Paths.get(binaryFilesFolder, fileName + "__java"), document, factory);
        assertDeserializeFromFile(Paths.get(binaryFilesFolder, fileName + "__cpp"), document, factory);
    }
Helper class with utils used in serialization and deserialization test cases.

@author geirst
document/src/test/java/com/yahoo/document/serialization/SerializationTestUtils.java