Skip to content

Commit

Permalink
Added a test to MoleculeSetTest, which tests that the clone() does no…
Browse files Browse the repository at this point in the history
…t change the MoleculeSEt

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
Stefan Kuhn authored and egonw committed Nov 27, 2009
1 parent b867fb2 commit 42915c4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/test/org/openscience/cdk/MoleculeSetTest.java
Expand Up @@ -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;

/**
Expand All @@ -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.