private void writeFileAtomically(String filename, String data) throws IOException {
        FileSystem fs = FileSystems.getDefault();
        Path filePath = fs.getPath(filename);
        Path tempFilePath = fs.getPath(filename + ".tmp");

        try (BufferedWriter bw = Files.newBufferedWriter(tempFilePath, StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) {
            bw.write(data);
        }

        // Try to atomically move temporary file onto file. This is guaranteed to be atomic due to the files existing in the same file system
        Files.move(tempFilePath, filePath, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
    }
The java side runs unit tests first. Thus java side will generate the distribution tests that the C++ side will verify equality with.
The tests serialized by the java side will be checked into version control, such that C++ side can test without java side. When one of the sides
change, the failing side can be identified by checking if the serialized files are modified from what is checked into version control.
vdslib/src/test/java/com/yahoo/vdslib/distribution/DistributionTestCase.java