Skip to content

Commit

Permalink
Moved test from the specific class to the abstract tests, as the beha…
Browse files Browse the repository at this point in the history
…vior should be the same for NNMoleculeSet and DebugMoleculeSet too

Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Apr 7, 2010
1 parent 3be2367 commit 068fb3b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
18 changes: 1 addition & 17 deletions src/test/org/openscience/cdk/MoleculeSetTest.java
Expand Up @@ -20,14 +20,9 @@
*/
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 @@ -46,16 +41,5 @@ 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));
}

}
Expand Up @@ -170,7 +170,18 @@ public abstract class AbstractMoleculeSetTest extends AbstractAtomContainerSetTe
Assert.assertTrue(clone instanceof IMoleculeSet);
Assert.assertNotSame(som, clone);
}


@Test public void testCloneButKeepOriginalIntact() throws CloneNotSupportedException{
IMoleculeSet moleculeSet = (IMoleculeSet)newChemObject();
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));
}

@Test public void testCloneDuplication() throws Exception {
IMoleculeSet moleculeSet = (IMoleculeSet)newChemObject();
moleculeSet.addMolecule(moleculeSet.getBuilder().newMolecule());
Expand Down

0 comments on commit 068fb3b

Please sign in to comment.