@Test
public void testEvaluate() throws Exception {

    WeightedPercentile wp = new WeightedPercentile(counts, metrics);
    // p100 is defined as the largest element
    double p100 = wp.evaluate(100.0);
    assertEquals(1000.0, p100, 0.01);
    double p99 = wp.evaluate(99.0);
    assertEquals(995.0, p99, 0.01);
    double p90 = wp.evaluate(90.0);
    assertEquals(949.0, p90, 0.01);
    double p50 = wp.evaluate(50.0);
    assertEquals(707.0, p50, 0.01);
    double p1 = wp.evaluate(1.0);
    assertEquals(100.0, p1, 0.01);
    double p0 = wp.evaluate(0.0);
    assertEquals(1.0, p0, 0.01);
}