コード例 #1
0
  @Test
  public void shouldGiveTheCorrectNearestPoint() {
    cut.insert(new Point2D(.0, .0));
    cut.insert(new Point2D(.0, .1));
    cut.insert(new Point2D(.0, .2));
    cut.insert(new Point2D(.0, .3));
    cut.insert(new Point2D(.0, .4));

    Point2D nearest = cut.nearest(new Point2D(.2, .2));

    assertEquals(new Point2D(.0, .2), nearest);
  }
コード例 #2
0
 @Test(expected = NullPointerException.class)
 public void shouldThrowNullPointerExceptionWhenCheckingNearestToNull() {
   cut.nearest(null);
 }