@Test
public void testEvaluate() throws Exception {

    LinearInterpolator interpolator = new LinearInterpolator(x, y);
    double result;
    result = interpolator.evaluate(-3);
    assertEquals(Double.NaN, result, 0.01);
    result = interpolator.evaluate(-2);
    assertEquals(1.0, result, 0.01);
    result = interpolator.evaluate(-1);
    assertEquals(2.0, result, 0.01);
    result = interpolator.evaluate(0);
    assertEquals(3.0, result, 0.01);
    result = interpolator.evaluate(0.5);
    assertEquals(3.0, result, 0.01);
    result = interpolator.evaluate(1);
    assertEquals(3.0, result, 0.01);
    result = interpolator.evaluate(1.5);
    assertEquals(5.0, result, 0.01);
    result = interpolator.evaluate(3);
    assertEquals(-1.0, result, 0.01);
    result = interpolator.evaluate(3.5);
    assertEquals(Double.NaN, result, 0.01);
}