Exemplo n.º 1
0
 @Test
 public void testWriteSMILESFile() throws Exception {
   StringWriter stringWriter = new StringWriter();
   IAtomContainer benzene = TestMoleculeFactory.makeBenzene();
   addImplicitHydrogens(benzene);
   SMILESWriter smilesWriter = new SMILESWriter(stringWriter);
   smilesWriter.write(benzene);
   smilesWriter.close();
   Assert.assertTrue(stringWriter.toString().contains("C=C"));
 }
Exemplo n.º 2
0
  @Test
  public void testWriteAromatic() throws Exception {
    StringWriter stringWriter = new StringWriter();
    IAtomContainer benzene = TestMoleculeFactory.makeBenzene();
    addImplicitHydrogens(benzene);
    CDKHueckelAromaticityDetector.detectAromaticity(benzene);

    SMILESWriter smilesWriter = new SMILESWriter(stringWriter);
    Properties prop = new Properties();
    prop.setProperty("UseAromaticity", "true");
    PropertiesListener listener = new PropertiesListener(prop);
    smilesWriter.addChemObjectIOListener(listener);
    smilesWriter.customizeJob();
    smilesWriter.write(benzene);
    smilesWriter.close();
    Assert.assertFalse(stringWriter.toString().contains("C=C"));
    Assert.assertTrue(stringWriter.toString().contains("ccc"));
  }
Exemplo n.º 3
0
 @Test
 public void testAccepts() throws Exception {
   SMILESWriter reader = new SMILESWriter();
   Assert.assertTrue(reader.accepts(AtomContainer.class));
   Assert.assertTrue(reader.accepts(AtomContainerSet.class));
 }