Skip to content

Commit

Permalink
Use interfaces instead of implementations
Browse files Browse the repository at this point in the history
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Nov 7, 2011
1 parent 5bef796 commit 76dcdf7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions src/test/org/openscience/cdk/io/MDLV2000ReaderTest.java
Expand Up @@ -32,7 +32,6 @@
import org.openscience.cdk.ChemModel;
import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.PseudoAtom;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.geometry.GeometryTools;
import org.openscience.cdk.interfaces.IAtom;
Expand Down Expand Up @@ -398,7 +397,7 @@ public class MDLV2000ReaderTest extends SimpleChemObjectReaderTest {
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
Molecule mol = reader.read(new Molecule());
Assert.assertEquals("R2",((PseudoAtom)mol.getAtom(19)).getLabel());
Assert.assertEquals("R2",((IPseudoAtom)mol.getAtom(19)).getLabel());
}

@Test public void testAliasPropertyGroup() throws Exception {
Expand All @@ -408,8 +407,8 @@ public class MDLV2000ReaderTest extends SimpleChemObjectReaderTest {
MDLV2000Reader reader = new MDLV2000Reader(ins);
Molecule mol = reader.read(new Molecule());
IAtom atom = mol.getAtom(3);
Assert.assertTrue(atom instanceof PseudoAtom);
Assert.assertEquals("R1", ((PseudoAtom)atom).getLabel());
Assert.assertTrue(atom instanceof IPseudoAtom);
Assert.assertEquals("R1", ((IPseudoAtom)atom).getLabel());
}

/**
Expand Down Expand Up @@ -711,15 +710,15 @@ public void testQueryBondTypes() throws Exception {
MDLV2000Reader reader = new MDLV2000Reader(ins);
Molecule mol = (Molecule)reader.read(new Molecule());
for(IBond bond: mol.bonds() ) {
PseudoAtom rGroup = null;
IPseudoAtom rGroup = null;
IAtom partner=null;
if (bond.getAtom(0) instanceof PseudoAtom ) {
rGroup = (PseudoAtom)bond.getAtom(0);
if (bond.getAtom(0) instanceof IPseudoAtom ) {
rGroup = (IPseudoAtom)bond.getAtom(0);
partner = bond.getAtom(1);
}
else {
partner = bond.getAtom(0);
rGroup = (PseudoAtom)bond.getAtom(1);
rGroup = (IPseudoAtom)bond.getAtom(1);
}
if (partner.getSymbol().equals("N")) {
Assert.assertEquals(rGroup.getLabel(),"R4");
Expand Down Expand Up @@ -753,11 +752,11 @@ public void testQueryBondTypes() throws Exception {
MDLV2000Reader reader = new MDLV2000Reader(ins);
Molecule mol = (Molecule)reader.read(new Molecule());
for(IBond bond: mol.bonds() ) {
PseudoAtom rGroup = null;
if (bond.getAtom(0) instanceof PseudoAtom )
rGroup = (PseudoAtom)bond.getAtom(0);
IPseudoAtom rGroup = null;
if (bond.getAtom(0) instanceof IPseudoAtom )
rGroup = (IPseudoAtom)bond.getAtom(0);
else
rGroup = (PseudoAtom)bond.getAtom(1);
rGroup = (IPseudoAtom)bond.getAtom(1);

if (bond.getOrder()== IBond.Order.DOUBLE) {
Assert.assertEquals(rGroup.getLabel(),"R32");
Expand Down
Expand Up @@ -329,7 +329,7 @@ public void testModel3D_bug_1610997() throws Exception{
for (Iterator iter = inputList.iterator(); iter.hasNext();) {
IAtomContainer molecules = (IAtomContainer) iter.next();
for (Iterator atom = molecules.atoms().iterator(); atom.hasNext();){
Atom last = (Atom) atom.next();
IAtom last = (IAtom) atom.next();
last.setPoint2d(null);
}
}
Expand Down

0 comments on commit 76dcdf7

Please sign in to comment.