private void writeDistributionTest(String name, String clusterState, String distributionConfig) throws IOException, ParseException, Distribution.TooFewBucketBitsInUseException, Distribution.NoDistributorsAvailableException {
        writeFileAtomically("src/tests/distribution/testdata/java_" + name + ".cfg", distributionConfig);
        writeFileAtomically("src/tests/distribution/testdata/java_" + name + ".state", clusterState);
        StringWriter sw = new StringWriter();
        Distribution distribution = new Distribution("raw:" + distributionConfig);
        ClusterState state = new ClusterState(clusterState);
        long maxBucket = 1;
        for (int distributionBits = 0; distributionBits <= 32; ++distributionBits) {
            state.setDistributionBits(distributionBits);
            RandomGen randomizer = new RandomGen(distributionBits);
            for (int bucketIndex = 0; bucketIndex < 64; ++bucketIndex) {
                if (bucketIndex >= maxBucket) break;
                long bucketId = bucketIndex;
                    // Use random bucket if we dont test all
                if (maxBucket > 64) {
                    bucketId = randomizer.nextLong();
                }
                BucketId bucket = new BucketId(distributionBits, bucketId);
                for (int redundancy = 1; redundancy <= distribution.getRedundancy(); ++redundancy) {
                    int distributorIndex = distribution.getIdealDistributorNode(state, bucket, "uim");
                    sw.write(distributionBits + " " + bucket.withoutCountBits() + " " + redundancy + " " + distributorIndex + "\n");
                }
            }
            maxBucket = maxBucket << 1;
        }

        writeFileAtomically("src/tests/distribution/testdata/java_" + name + ".distribution", sw.toString());
    }
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