@Test
public void testGetNearestVectorFromBonds() throws Exception {

    IAtom a1 = mock(IAtom.class);
    IAtom a2 = mock(IAtom.class);
    IAtom a3 = mock(IAtom.class);
    IAtom a4 = mock(IAtom.class);
    IBond b1 = mock(IBond.class);
    IBond b2 = mock(IBond.class);
    IBond b3 = mock(IBond.class);
    when(b1.getOther(a1)).thenReturn(a2);
    when(b2.getOther(a1)).thenReturn(a3);
    when(b3.getOther(a1)).thenReturn(a4);
    when(a1.getPoint2d()).thenReturn(new Point2d(0, 0));
    when(a2.getPoint2d()).thenReturn(new Point2d(0, 1));
    when(a3.getPoint2d()).thenReturn(new Point2d(1, 0));
    when(a4.getPoint2d()).thenReturn(new Point2d(1, 1)); // this one is
                                                         // found
    Vector2d nearest = VecmathUtil.getNearestVector(new Vector2d(0.5, 0.5), a1, Arrays.asList(b1, b2, b3));
    assertThat(nearest.x, closeTo(0.707d, 0.01));
    assertThat(nearest.y, closeTo(0.707d, 0.01));
}