コード例 #1
0
ファイル: SMILESWriterTest.java プロジェクト: jctoledo/cdk
 @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"));
 }
コード例 #2
0
ファイル: SMILESWriterTest.java プロジェクト: jctoledo/cdk
  @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"));
  }