Permalink
Browse files

Random test order causes failure now default option is to ignore arom…

…aticity.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information...
johnmay authored and egonw committed Mar 26, 2014
1 parent 1d51037 commit 2f7e936b18135564058ab4896f98f59bb8f1f223
Showing with 36 additions and 31 deletions.
  1. +36 −31 storage/inchi/src/test/java/org/openscience/cdk/inchi/InChIGeneratorFactoryTest.java
@@ -173,36 +173,41 @@ public void testGetInChIToStructure_String_IChemObjectBuilder_NullList() throws
*/
@Test public void testInChIGenerator_AromaticBonds() throws CDKException {
- // create a fairly complex aromatic molecule
- IAtomContainer tetrazole = TestMoleculeFactory.makeTetrazole();
- AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(tetrazole);
- CDKHueckelAromaticityDetector.detectAromaticity(tetrazole);
-
- InChIGeneratorFactory inchiFactory = InChIGeneratorFactory.getInstance();
-
- // include aromatic bonds by default
- InChIGenerator genAromaticity1 = inchiFactory.getInChIGenerator(tetrazole);
-
- // exclude aromatic bonds
- assertFalse(inchiFactory.getIgnoreAromaticBonds());
- inchiFactory.setIgnoreAromaticBonds(true);
- assertTrue(inchiFactory.getIgnoreAromaticBonds());
- InChIGenerator genNoAromaticity = inchiFactory.getInChIGenerator(tetrazole);
-
- // include aromatic bonds again
- inchiFactory.setIgnoreAromaticBonds(false);
- assertFalse(inchiFactory.getIgnoreAromaticBonds());
- InChIGenerator genAromaticity2 = inchiFactory.getInChIGenerator(tetrazole);
-
- // with the aromatic bonds included, no InChI can be generated
- Assert.assertEquals("return status was not in error",
- INCHI_RET.ERROR, genAromaticity1.getReturnStatus());
- Assert.assertEquals("return status was not in error",
- INCHI_RET.ERROR, genAromaticity2.getReturnStatus());
- // excluding the aromatic bonds gives the normal InChI
- Assert.assertEquals("return status was not okay",
- INCHI_RET.OKAY, genNoAromaticity.getReturnStatus());
- Assert.assertEquals("InChIs did not match",
- "InChI=1S/CH2N4/c1-2-4-5-3-1/h1H,(H,2,3,4,5)", genNoAromaticity.getInchi());
+ try {
+ // create a fairly complex aromatic molecule
+ IAtomContainer tetrazole = TestMoleculeFactory.makeTetrazole();
+ AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(tetrazole);
+ CDKHueckelAromaticityDetector.detectAromaticity(tetrazole);
+
+ InChIGeneratorFactory inchiFactory = InChIGeneratorFactory.getInstance();
+ inchiFactory.setIgnoreAromaticBonds(false);
+
+ // include aromatic bonds by default
+ InChIGenerator genAromaticity1 = inchiFactory.getInChIGenerator(tetrazole);
+
+ // exclude aromatic bonds
+ assertFalse(inchiFactory.getIgnoreAromaticBonds());
+ inchiFactory.setIgnoreAromaticBonds(true);
+ assertTrue(inchiFactory.getIgnoreAromaticBonds());
+ InChIGenerator genNoAromaticity = inchiFactory.getInChIGenerator(tetrazole);
+
+ // include aromatic bonds again
+ inchiFactory.setIgnoreAromaticBonds(false);
+ assertFalse(inchiFactory.getIgnoreAromaticBonds());
+ InChIGenerator genAromaticity2 = inchiFactory.getInChIGenerator(tetrazole);
+
+ // with the aromatic bonds included, no InChI can be generated
+ Assert.assertEquals("return status was not in error",
+ INCHI_RET.ERROR, genAromaticity1.getReturnStatus());
+ Assert.assertEquals("return status was not in error",
+ INCHI_RET.ERROR, genAromaticity2.getReturnStatus());
+ // excluding the aromatic bonds gives the normal InChI
+ Assert.assertEquals("return status was not okay",
+ INCHI_RET.OKAY, genNoAromaticity.getReturnStatus());
+ Assert.assertEquals("InChIs did not match",
+ "InChI=1S/CH2N4/c1-2-4-5-3-1/h1H,(H,2,3,4,5)", genNoAromaticity.getInchi());
+ } finally {
+ InChIGeneratorFactory.getInstance().setIgnoreAromaticBonds(true);
+ }
}
}

0 comments on commit 2f7e936

Please sign in to comment.