@Override public IChemObject newTestObject() { return new ChemSequence(); } });
@Override public void startDocument() { chemFile = new ChemFile(); chemSequence = new ChemSequence(); chemModel = new ChemModel(); setOfMolecules = new AtomContainerSet(); }
@BeforeClass public static void setUp() { setTestObjectBuilder(new ITestObjectBuilder() { @Override public IChemObject newTestObject() { return new ChemSequence(); } }); }
@Test public void testChemSequence() { IChemSequence cs = new ChemSequence(); Assert.assertNotNull(cs); }
@Before public void setUp() { molecule1 = new AtomContainer(); atomInMol1 = new Atom("Cl"); molecule1.addAtom(atomInMol1); molecule1.addAtom(new Atom("Cl")); bondInMol1 = new Bond(atomInMol1, molecule1.getAtom(1)); molecule1.addBond(bondInMol1); molecule2 = new AtomContainer(); atomInMol2 = new Atom("O"); atomInMol2.setImplicitHydrogenCount(2); molecule2.addAtom(atomInMol2); moleculeSet = new AtomContainerSet(); moleculeSet.addAtomContainer(molecule1); moleculeSet.addAtomContainer(molecule2); reaction = new Reaction(); reaction.addReactant(molecule1); reaction.addProduct(molecule2); reactionSet = new ReactionSet(); reactionSet.addReaction(reaction); chemModel = new ChemModel(); chemModel.setMoleculeSet(moleculeSet); chemModel.setReactionSet(reactionSet); chemSequence1 = new ChemSequence(); chemSequence1.addChemModel(chemModel); chemSequence2 = new ChemSequence(); chemFile = new ChemFile(); chemFile.addChemSequence(chemSequence1); chemFile.addChemSequence(chemSequence2); }
@Test public void testPropagation() { ChemFile cf = new ChemFile(); ChemSequence cs = new ChemSequence(); ChemModel cm = new ChemModel(); IAtomContainerSet som = new AtomContainerSet(); IAtomContainer mol = new AtomContainer(); Atom a1 = new Atom("C"); Atom a2 = new Atom("C"); Bond b1 = new Bond(a1, a2); mol.addAtom(a1); mol.addAtom(a2); mol.addBond(b1); som.addAtomContainer(mol); cm.setMoleculeSet(som); cs.addChemModel(cm); cf.addChemSequence(cs); TestListener ts = new TestListener(); cf.addListener(ts); a2.setSymbol("N"); Assert.assertTrue(ts.changedObject instanceof Atom); Assert.assertEquals("N", ((Atom) ts.changedObject).getSymbol()); }
@Before public void setUp() { molecule1 = new AtomContainer(); atomInMol1 = new Atom("Cl"); molecule1.addAtom(atomInMol1); molecule1.addAtom(new Atom("Cl")); bondInMol1 = new Bond(atomInMol1, molecule1.getAtom(1)); molecule1.addBond(bondInMol1); molecule2 = new AtomContainer(); atomInMol2 = new Atom("O"); atomInMol2.setImplicitHydrogenCount(2); molecule2.addAtom(atomInMol2); moleculeSet = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class); moleculeSet.addAtomContainer(molecule1); moleculeSet.addAtomContainer(molecule2); reaction = new Reaction(); reaction.addReactant(molecule1); reaction.addProduct(molecule2); reactionSet = new ReactionSet(); reactionSet.addReaction(reaction); chemModel1 = new ChemModel(); chemModel1.setMoleculeSet(moleculeSet); chemModel2 = new ChemModel(); chemModel2.setReactionSet(reactionSet); chemSequence = new ChemSequence(); chemSequence.addChemModel(chemModel1); chemSequence.addChemModel(chemModel2); }