@Test(expected = CDKException.class) public void upDoubleBond() throws Exception { String input = " 1 3 2 1 0 0 0"; reader.setReaderMode(IChemObjectReader.Mode.STRICT); reader.readBondFast(input, builder, atoms, new int[atoms.length], 1); }
@Test(expected = CDKException.class) public void cisOrTransSingleBond() throws Exception { String input = " 1 3 1 3 0 0 0"; reader.setReaderMode(IChemObjectReader.Mode.STRICT); reader.readBondFast(input, builder, atoms, new int[atoms.length], 1); }
@Test(expected = CDKException.class) public void downDoubleBond() throws Exception { String input = " 1 3 2 1 0 0 0"; reader.setReaderMode(IChemObjectReader.Mode.STRICT); reader.readBondFast(input, builder, atoms, new int[atoms.length], 1); }
@Test(expected = CDKException.class) public void upOrDownDoubleBond() throws Exception { String input = " 1 3 2 4 0 0 0"; reader.setReaderMode(IChemObjectReader.Mode.STRICT); reader.readBondFast(input, builder, atoms, new int[atoms.length], 1); }
@Test public void readMDLCoordinates_wrong_decimal_position_relaxed() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.RELAXED); assertThat(reader.readMDLCoordinate(" -2.0012 7.8089 ", 10), is(closeTo(7.8089, 0.1))); }
@Test public void readMDLCoordinates_no_decimal_relaxed() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.RELAXED); assertThat(reader.readMDLCoordinate(" -2.0012 708089 ", 10), is(closeTo(708089, 0.1))); } }
@Test public void readMDLCoordinates_no_value_relaxed() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.RELAXED); assertThat(reader.readMDLCoordinate(" -2.0012 ", 10), is(closeTo(0.0, 0.1))); }
@Test(expected = CDKException.class) public void testSgroupInvalidConnectInStrictMode() throws Exception { try (MDLV2000Reader mdlr = new MDLV2000Reader(getClass().getResourceAsStream("/data/mdl/sgroup-sru-bad-scn.mol"))) { mdlr.setReaderMode(Mode.STRICT); IAtomContainer container = mdlr.read(new AtomContainer()); } }
@Test(expected = CDKException.class) public void testSgroupDefOrderInStrictMode() throws Exception { try (MDLV2000Reader mdlr = new MDLV2000Reader(getClass().getResourceAsStream("/data/mdl/sgroup-sru-bad-def.mol"))) { mdlr.setReaderMode(Mode.STRICT); IAtomContainer container = mdlr.read(new AtomContainer()); } }
@Test public void readOldJmolCoords() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.RELAXED); assertThat(reader.readMDLCoordinate(" -2.00120 7.8089", 0), is(closeTo(-2.00120, 0.1))); }
@Test(expected = CDKException.class) public void readMDLCoordinates_wrong_decimal_position_strict() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.STRICT); assertThat(reader.readMDLCoordinate(" -2.0012 7.8089 ", 10), is(closeTo(7.8089, 0.1))); }
@Test(expected = CDKException.class) public void readOldJmolCoordsFailOnStrictRead() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.STRICT); reader.readMDLCoordinate(" -2.00120 7.8089", 0); }
"\n"; final MDLV2000Reader mdlv2000Reader = new MDLV2000Reader(new ByteArrayInputStream(mol.getBytes(StandardCharsets.UTF_8))); mdlv2000Reader.setReaderMode(IChemObjectReader.Mode.RELAXED); final org.openscience.cdk.silent.AtomContainer atomContainer = mdlv2000Reader.read(new org.openscience.cdk.silent.AtomContainer()); Assert.assertEquals(17, atomContainer.getAtomCount());