@Test public void testReadAtomTypes_IChemObjectBuilder() throws Exception { CDKBasedAtomTypeConfigurator configurator = new CDKBasedAtomTypeConfigurator(); String configFile = "org/openscience/cdk/config/data/structgen_atomtypes.xml"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(configFile); configurator.setInputStream(ins); Assert.assertNotSame(0, configurator.readAtomTypes(new ChemObject().getBuilder()).size()); }
@Test public void testReadIsotopes() { IsotopeReader reader = new IsotopeReader(new ByteArrayInputStream("<?xml version=\"1.0\"?><list></list>".getBytes(StandardCharsets.UTF_8)), new ChemObject().getBuilder()); Assert.assertNotNull(reader); List<IIsotope> isotopes = reader.readIsotopes(); Assert.assertNotNull(isotopes); Assert.assertEquals(0, isotopes.size()); }
@Test public void testReadAtomTypes_IChemObjectBuilder() { OWLAtomTypeReader reader = new OWLAtomTypeReader(new StringReader(OWL_CONTENT)); Assert.assertNotNull(reader); List<IAtomType> types = reader.readAtomTypes(new ChemObject().getBuilder()); Assert.assertNotNull(types); Assert.assertEquals(1, types.size()); }
@Test public void testGetInstance_IChemObjectBuilder() throws Exception { AtomTypeFactory atf = AtomTypeFactory.getInstance(new ChemObject().getBuilder()); Assert.assertNotNull(atf); }
@Test public void testGetMajorIsotope_String() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope isotope = isofac.getMajorIsotope("Te"); if (standAlone) System.out.println("Isotope: " + isotope); Assert.assertEquals(129.9062244, isotope.getExactMass(), 0.0001); }
@Test public void testIsotopeHandler_IChemObjectBuilder() { IsotopeHandler handler = new IsotopeHandler(new ChemObject().getBuilder()); Assert.assertNotNull(handler); }
@Test public void testGetIsotopes() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope[] list = isofac.getIsotopes(); Assert.assertTrue(list.length > 200); }
@Test public void testGetIsotopes_double_double() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope[] list = isofac.getIsotopes(87.90, 0.01); // should return: // Isotope match: 88Sr has mass 87.9056121 // Isotope match: 88Y has mass 87.9095011 Assert.assertEquals(2, list.length); Assert.assertEquals(88, list[0].getMassNumber().intValue()); Assert.assertEquals(88, list[1].getMassNumber().intValue()); }
@Test public void testGetSize() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); Assert.assertTrue(isofac.getSize() > 0); }
@Test public void testConfigure_IAtom() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); Atom atom = new Atom("H"); isofac.configure(atom); Assert.assertEquals(1, atom.getAtomicNumber().intValue()); }
@Test public void testGetMajorIsotope_Nonelement() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope isotope = isofac.getMajorIsotope("E"); Assert.assertNull(isotope); }
@Test public void testAtomTypeHandler_IChemObjectBuilder() { OWLAtomTypeHandler handler = new OWLAtomTypeHandler(new ChemObject().getBuilder()); Assert.assertNotNull(handler); }
@Test public void testGetIsotopes_String() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope[] list = isofac.getIsotopes("He"); Assert.assertEquals(8, list.length); }
@Test public void testGetAllAtomTypes() throws Exception { AtomTypeFactory atf = AtomTypeFactory.getInstance(new ChemObject().getBuilder()); IAtomType[] types = atf.getAllAtomTypes(); Assert.assertNotNull(types); Assert.assertNotSame(0, types.length); }
@Test public void testGetInstance_String_IChemObjectBuilder() throws Exception { String configFile = "org/openscience/cdk/config/data/structgen_atomtypes.xml"; AtomTypeFactory atf = AtomTypeFactory.getInstance(configFile, new ChemObject().getBuilder()); Assert.assertNotNull(atf); Assert.assertNotSame(0, atf.getSize()); }
@Test public void testGetIsotopes_Nonelement() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope[] list = isofac.getIsotopes("E"); Assert.assertNotNull(list); Assert.assertEquals(0, list.length); }
@Test public void testGetAtomTypes() { AtomTypeHandler handler = new AtomTypeHandler(new ChemObject().getBuilder()); // nothing is read Assert.assertNotNull(handler); Assert.assertNull(handler.getAtomTypes()); }
@Test public void testGetAtomTypes() { OWLAtomTypeHandler handler = new OWLAtomTypeHandler(new ChemObject().getBuilder()); // nothing is read Assert.assertNotNull(handler); Assert.assertNull(handler.getAtomTypes()); }
@Test public void testGetIsotopeFromExactMass_LargeTolerance() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope carbon13 = isofac.getIsotope("C", 13); IIsotope match = isofac.getIsotope(carbon13.getSymbol(), carbon13.getExactMass(), 2.0); Assert.assertNotNull(match); Assert.assertEquals(13, match.getMassNumber().intValue()); }
@Test public void testConfigure_IAtom() throws Exception { IAtomType atomType; IAtom atom = new org.openscience.cdk.Atom(); atom.setAtomTypeName("C.ar"); AtomTypeFactory factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/mol2_atomtypes.xml", new ChemObject().getBuilder()); atomType = factory.configure(atom); Assert.assertNotNull(atomType); Assert.assertEquals("C", atom.getSymbol()); }