@Override public IChemObject newTestObject() { return new ChemObject(); } });
@Test public void testIsotopeHandler_IChemObjectBuilder() { IsotopeHandler handler = new IsotopeHandler(new ChemObject().getBuilder()); Assert.assertNotNull(handler); }
@Test public void compare() { ChemObject co1 = new ChemObject(); ChemObject co2 = new ChemObject(); co1.setID(new String("a1")); co2.setID(new String("a1")); Assert.assertTrue(co1.compare(co2)); }
@Test public void testAtomTypeHandler_IChemObjectBuilder() { OWLAtomTypeHandler handler = new OWLAtomTypeHandler(new ChemObject().getBuilder()); Assert.assertNotNull(handler); }
@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 testGetAtomTypes() { OWLAtomTypeHandler handler = new OWLAtomTypeHandler(new ChemObject().getBuilder()); // nothing is read Assert.assertNotNull(handler); Assert.assertNull(handler.getAtomTypes()); }
@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 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 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 testGetIsotopes_String() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope[] list = isofac.getIsotopes("He"); Assert.assertEquals(8, list.length); }
@Test public void testGetSize() throws Exception { AtomTypeFactory atf = AtomTypeFactory.getInstance(new ChemObject().getBuilder()); Assert.assertNotSame(0, atf.getSize()); }
@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 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 testGetMajorIsotope_int() throws Exception { XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); IIsotope isotope = isofac.getMajorIsotope(17); Assert.assertEquals("Cl", isotope.getSymbol()); }
@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 testUnmarkWithWarning_IChemObject() { IChemObject object = new ChemObject(); Assert.assertNull(object.getProperty(ProblemMarker.WARNING_MARKER)); ProblemMarker.markWithWarning(object); Assert.assertNotNull(object.getProperty(ProblemMarker.WARNING_MARKER)); ProblemMarker.unmarkWithWarning(object); Assert.assertNull(object.getProperty(ProblemMarker.WARNING_MARKER)); }
@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()); }
@Test public void testGetAtomTypeFromPDB() throws Exception { AtomTypeFactory factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/pdb_atomtypes.xml", new ChemObject().getBuilder()); IAtomType atomType = factory.getAtomType("ALA.CA"); Assert.assertNotNull(atomType); Assert.assertEquals("C", atomType.getSymbol()); Assert.assertEquals("ALA.CA", atomType.getAtomTypeName()); }
@Test public void testGetAtomTypeFromJmol() throws Exception { AtomTypeFactory factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/jmol_atomtypes.txt", new ChemObject().getBuilder()); IAtomType atomType = factory.getAtomType("H"); Assert.assertNotNull(atomType); Assert.assertEquals("H", atomType.getSymbol()); Assert.assertEquals("H", atomType.getAtomTypeName()); }