Exemplo n.º 1
0
 /** A unit test for JUnit */
 @Test
 public void testPartitioning() {
   String smiles = "";
   IAtomContainer molecule = new AtomContainer();
   SmilesGenerator sg = new SmilesGenerator();
   Atom sodium = new Atom("Na");
   sodium.setFormalCharge(+1);
   Atom hydroxyl = new Atom("O");
   hydroxyl.setImplicitHydrogenCount(1);
   hydroxyl.setFormalCharge(-1);
   molecule.addAtom(sodium);
   molecule.addAtom(hydroxyl);
   try {
     smiles = sg.createSMILES(molecule);
   } catch (Exception exc) {
     System.out.println(exc);
     if (!standAlone) {
       Assert.fail();
     }
   }
   if (standAlone) {
     System.err.println("SMILES: " + smiles);
   }
   Assert.assertTrue(smiles.indexOf(".") != -1);
 }
Exemplo n.º 2
0
 /** Tests whether the saturation checker gets a proton right. */
 @Test
 public void testIsSaturated_Proton() throws Exception {
   // test H+
   IAtomContainer m = new AtomContainer();
   Atom h = new Atom("H");
   h.setFormalCharge(+1);
   m.addAtom(h);
   Assert.assertTrue(satcheck.isSaturated(h, m));
 }