JADT { public static void main(String[] args) { standardConfigDriver().parseAndEmit(args); } JADT(SourceFactory sourceFactory, Parser parser, Checker checker, DocEmitter emitter, SinkFactoryFactory factoryFactory); static void main(String[] args); static JADT standardConfigDriver(); void parseAndEmit(String[] args); void parseAndEmit(String srcPath, final String destDir); static JADT createDummyJADT(List<SyntaxError> syntaxErrors, List<SemanticError> semanticErrors, String testSrcInfo, SinkFactoryFactory factory); static final String TEST_CLASS_NAME; static final String TEST_SRC_INFO; static final String TEST_DIR; }
@Test public void testMain() throws IOException { final File srcFile = File.createTempFile("tmp", ".jadt"); try { final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(srcFile), "UTF-8")); try { writer.write("Foo = Foo"); writer.close(); final File tmpDir = TestUtil.createTmpDir(); try { JADT.main(new String[]{srcFile.getAbsolutePath(), tmpDir.getAbsolutePath()}); final File outputFile = new File(tmpDir, "Foo.java"); try { assertTrue("Could not find output file at " + outputFile.getAbsolutePath(), outputFile.exists()); final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(outputFile), "UTF-8")); try { assertStartsWith("/*", reader.readLine()); assertStartsWith("This file was generated based on ", reader.readLine()); } finally { reader.close(); } } finally { outputFile.delete(); } } finally { tmpDir.delete(); } } finally { writer.close(); } } finally { srcFile.delete(); } }