static IAtom atom(String symbol, int hCount) { IAtom a = new Atom(symbol); a.setImplicitHydrogenCount(hCount); return a; } }
@Test public void testChemObjectChangeEvent_Object() { ChemObjectChangeEvent event = new ChemObjectChangeEvent(new Atom()); Assert.assertNotNull(event); } }
static IAtom atom(String symbol, int h, boolean arom) { IAtom a = new Atom(symbol); a.setImplicitHydrogenCount(h); a.setFlag(CDKConstants.ISAROMATIC, arom); return a; }
@Test public void testMethylAmine() throws Exception { IAtomContainer mol = new AtomContainer(); IAtom atom = new Atom("N"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); mol.addBond(0, 1, Order.SINGLE); String[] expectedTypes = {"N.3", "C.3"}; assertAtomTypes(testedAtomTypes, expectedTypes, mol); }
@Test(expected = IllegalArgumentException.class) public void testNullContainer() { HydrogenPlacer hydrogenPlacer = new HydrogenPlacer(); hydrogenPlacer.placeHydrogens2D(null, new Atom(), 1.5); }
@Test public void testGetCurr() { IAtom atom = new Atom(Elements.CARBON); InvPair pair = new InvPair(5l, atom); Assert.assertEquals(5l, pair.getCurr()); }
@Test public void testGetLast() { IAtom atom = new Atom(Elements.CARBON); InvPair pair = new InvPair(5l, atom); Assert.assertEquals(0l, pair.getLast()); } }
@Test public void testToString() { IAtom atom = new Atom(Elements.CARBON); InvPair pair = new InvPair(5l, atom); Assert.assertNotNull(pair.toString()); Assert.assertTrue(pair.toString().length() > 0); }
@Test public void carbon_cation() { IAtomContainer container = new AtomContainer(); IAtom atom = new Atom("C"); atom.setFormalCharge(-1); container.addAtom(atom); MDLValence.apply(container); assertThat(atom.getValency(), is(3)); assertThat(atom.getImplicitHydrogenCount(), is(3)); }
@Test public void testChlorRadical() throws Exception { IAtomContainer mol = new AtomContainer(); IAtom atom = new Atom("Cl"); mol.addAtom(atom); mol.addSingleElectron(0); String[] expectedTypes = {"Cl.radical"}; assertAtomTypes(testedAtomTypes, expectedTypes, mol); }
@Test public void testAtom_IElement() { IElement element = newChemObject().getBuilder().newInstance(IElement.class); IAtom a = new Atom(element); Assert.assertNotNull(a); }
/** * @cdk.bug 780545 */ @Test(timeout = 5000) public void testBug780545() throws Exception { IAtomContainer mol = new AtomContainer(); mol.addAtom(new Atom("C")); IAtomContainer ac = layout(mol); assertTrue(GeometryUtil.has2DCoordinates(ac)); }
@Test public void testGetClosestAtom_Double_Double_IAtomContainer_IAtom() { IAtom atom1 = new Atom("C"); atom1.setPoint2d(new Point2d(1, 0)); IAtom atom2 = new Atom("C"); atom2.setPoint2d(new Point2d(5, 0)); IAtomContainer acont = new AtomContainer(); acont.addAtom(atom1); acont.addAtom(atom2); Assert.assertEquals(atom2, GeometryUtil.getClosestAtom(1.0, 0.0, acont, atom1)); Assert.assertEquals(atom1, GeometryUtil.getClosestAtom(1.0, 0.0, acont, null)); }
@Test public void testGetAtom() { InvPair pair = new InvPair(); Assert.assertNull(pair.getAtom()); pair.setAtom(new Atom(Elements.CARBON)); Assert.assertNotNull(pair.getAtom()); }
@Test public void testSetCurr_long() { IAtom atom = new Atom(Elements.CARBON); InvPair pair = new InvPair(5l, atom); Assert.assertEquals(5l, pair.getCurr()); pair.setCurr(4l); Assert.assertEquals(4l, pair.getCurr()); }
@Test public void testRotate_IAtom_Point3d_Point3d_double() { Atom atom1 = new Atom("C"); atom1.setPoint3d(new Point3d(1, 1, 0)); GeometryUtil.rotate(atom1, new Point3d(2, 0, 0), new Point3d(2, 2, 0), 90); assertEquals(new Point3d(2.0, 1.0, 1.0), atom1.getPoint3d(), 0.2); }
/** * Method to test the Atom(String symbol, javax.vecmath.Point3d point3D) method. */ @Test public void testAtom_String_Point3d() { Point3d point3d = new Point3d(1.0, 2.0, 3.0); IAtom a = new Atom("C", point3d); Assert.assertEquals("C", a.getSymbol()); Assert.assertEquals(point3d, a.getPoint3d()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test public void testAtom_Ca2plus() { IAtom a = new Atom("Ca+2"); Assert.assertEquals("Ca", a.getSymbol()); Assert.assertEquals((Integer) 20, a.getAtomicNumber()); Assert.assertEquals(null, a.getImplicitHydrogenCount()); Assert.assertEquals(Integer.valueOf(+2), a.getFormalCharge()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getPoint3d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test public void testAtom_NH4plus_direct() { IAtom a = new Atom(7, 4, +1); Assert.assertEquals("N", a.getSymbol()); Assert.assertEquals((Integer) 7, a.getAtomicNumber()); Assert.assertEquals((Integer) 4, a.getImplicitHydrogenCount()); Assert.assertEquals((Integer) 1, a.getFormalCharge()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getPoint3d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test public void testAtom_Cl_direct() { IAtom a = new Atom(17); Assert.assertEquals("Cl", a.getSymbol()); Assert.assertEquals((Integer) 17, a.getAtomicNumber()); Assert.assertEquals((Integer) 0, a.getImplicitHydrogenCount()); Assert.assertEquals((Integer) 0, a.getFormalCharge()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getPoint3d()); Assert.assertNull(a.getFractionalPoint3d()); }