Permalink
Browse files

Added a test to MoleculeSetTest, which tests that the clone() does no…

…t change the MoleculeSEt

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information...
1 parent b867fb2 commit 42915c4ac736640e7e341e637053fb2e4fd30092 Stefan Kuhn committed with Nov 27, 2009
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/test/org/openscience/cdk/MoleculeSetTest.java
@@ -20,9 +20,14 @@
*/
package org.openscience.cdk;
+import junit.framework.Assert;
+
import org.junit.BeforeClass;
+import org.junit.Test;
import org.openscience.cdk.interfaces.AbstractMoleculeSetTest;
import org.openscience.cdk.interfaces.IChemObject;
+import org.openscience.cdk.interfaces.IMolecule;
+import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.ITestObjectBuilder;
/**
@@ -41,5 +46,16 @@ public IChemObject newTestObject() {
}
});
}
-
+
+ @Test public void testClone() throws CloneNotSupportedException{
+ IMoleculeSet moleculeSet = DefaultChemObjectBuilder.getInstance()
+ .newMoleculeSet();
+ IMolecule mol = moleculeSet.getBuilder().newMolecule();
+ moleculeSet.addAtomContainer(mol);
+ //we test that the molecule added is actually in the moleculeSet
+ Assert.assertSame(mol, moleculeSet.getAtomContainer(0));
+ moleculeSet.clone();
+ //after the clone, the molecule added should still be in the moleculeSet
+ Assert.assertSame(mol, moleculeSet.getAtomContainer(0));
+ }
}

0 comments on commit 42915c4

Please sign in to comment.