@Test
public void testEstimateDistanceSquared() throws Exception {

    this.setUpVerySimpleCsv();
    KDTree node;
    node = new KDTree(data, 2);
    for (Datum datum : data) {
        // Check that minimum distance is zero if the point is inside.
        assertEquals(0, node.estimateL2DistanceSquared(datum)[0], 1e-7);
    }
    double[] farAwayPoint = {-10, 5, 21};
    double[] distancesSquaredFromFarAwayPoint = {265, 857};
    Datum datum = new Datum(new ArrayList<>(), new ArrayRealVector(farAwayPoint));
    assertArrayEquals(distancesSquaredFromFarAwayPoint, node.estimateL2DistanceSquared(datum), 1e-7);
}