Skip to content
Permalink
Browse files

Missing unit test for AtomContainerSet.sort(Comparator)

Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information...
egonw authored and rajarshi committed Oct 22, 2010
1 parent 853ca50 commit 0585bcdf7f76756691cac243fbcc9ceaab808f88
Showing with 26 additions and 0 deletions.
  1. +26 −0 src/test/org/openscience/cdk/interfaces/AbstractAtomContainerSetTest.java
@@ -25,6 +25,7 @@

import org.junit.Assert;
import org.junit.Test;
import org.openscience.cdk.tools.manipulator.AtomContainerComparator;

/**
* Checks the functionality of {@link IAtomContainerSet} implementations.
@@ -33,6 +34,31 @@
*/
public abstract class AbstractAtomContainerSetTest extends AbstractChemObjectTest {

/**
* @cdk.bug 3093241
*/
@Test
public void testSortAtomContainers_Comparator_Null() {
IAtomContainerSet som = (IAtomContainerSet)newChemObject();
IChemObjectBuilder builder = som.getBuilder();
IAtomContainer con1 = builder.newInstance(IAtomContainer.class);
con1.addAtom(builder.newInstance(IAtom.class, "C"));
con1.addAtom(builder.newInstance(IAtom.class, "C"));
IAtomContainer con2 = builder.newInstance(IAtomContainer.class);
con2.addAtom(builder.newInstance(IAtom.class, "C"));
som.addAtomContainer(con1);
som.addAtomContainer(con2);
Assert.assertNotNull(som.getAtomContainer(0));
Assert.assertNotNull(som.getAtomContainer(1));

AtomContainerComparator comparator = new AtomContainerComparator();
som.sortAtomContainers(comparator);
Assert.assertNotNull(som.getAtomContainer(0));
Assert.assertEquals(1, som.getAtomContainer(0).getAtomCount());
Assert.assertNotNull(som.getAtomContainer(1));
Assert.assertEquals(2, som.getAtomContainer(1).getAtomCount());
}

@Test public void testGetAtomContainerCount() {
IAtomContainerSet som = (IAtomContainerSet)newChemObject();
som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class));

0 comments on commit 0585bcd

Please sign in to comment.
You can’t perform that action at this time.