Skip to content

Commit

Permalink
Added missing unit test for getClosestAtom(double, double, IAtomConta…
Browse files Browse the repository at this point in the history
…iner, IAtom)

Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Feb 21, 2010
1 parent 46b5f83 commit 95f811a
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/test/org/openscience/cdk/geometry/GeometryToolsTest.java
@@ -1,6 +1,4 @@
/* $Revision$ $Author$ $Date$
*
* Copyright (C) 2004-2008 Egon Willighagen <egonw@users.sf.net>
/* Copyright (C) 2004-2010 Egon Willighagen <egonw@users.sf.net>
*
* Contact: cdk-devel@lists.sourceforge.net
*
Expand Down Expand Up @@ -413,6 +411,22 @@ public class GeometryToolsTest extends CDKTestCase {
Assert.assertEquals(atom2, GeometryTools.getClosestAtom(acont, atom3));
}

@Test public void testGetClosestAtom_Double_Double_IAtomContainer_IAtom() {
IAtom atom1 = new Atom("C");
atom1.setPoint2d(new Point2d(1,0));
IAtom atom2 = new Atom("C");
atom2.setPoint2d(new Point2d(5,0));
IAtomContainer acont = new AtomContainer();
acont.addAtom(atom1);
acont.addAtom(atom2);
Assert.assertEquals(
atom2, GeometryTools.getClosestAtom(1.0, 0.0, acont, atom1)
);
Assert.assertEquals(
atom1, GeometryTools.getClosestAtom(1.0, 0.0, acont, null)
);
}

/**
* Tests if not the central atom is returned as closest atom.
*/
Expand Down

0 comments on commit 95f811a

Please sign in to comment.