@Test
public void testEarthMoversDistanceCalculation() {

    // Using the example from http://www.mathcs.emory.edu/~cheung/Courses/323/Syllabus/Transportation/algorithm.html
    double emd = ForeignKeys.calculateEarthMoverDistance(
            new double[]{6, 9},
            new double[]{4, 6, 5},
            new double[][]{
                    new double[]{3, 5, 7},
                    new double[]{6, 4, 3}
            }
    );
    Assert.assertEquals(4 * 3 + 2 * 5 + 4 * 4 + 5 * 3, emd, 0.0001);
}