View Javadoc
1   package org.melati.app.test;
2   
3   import junit.framework.TestCase;
4   import org.melati.app.DSDApp;
5   import org.melati.app.JavinatorApp;
6   
7   import java.io.BufferedReader;
8   import java.io.File;
9   import java.io.FileInputStream;
10  import java.io.InputStreamReader;
11  
12  /**
13   * @author timp
14   * @since 2017-01-27
15   */
16  public class JavinatorAppTest extends TestCase {
17  
18    public JavinatorAppTest(String name) {
19      super(name);
20    }
21  
22    protected void setUp() throws Exception {
23      super.setUp();
24    }
25  
26    protected void tearDown() throws Exception {
27      super.tearDown();
28    }
29  
30    public void testRun() throws Exception {
31      String fileName = "t1.tmp";
32      String[] args = { "appjunit", "tableinfo", "8", "-o", fileName };
33      JavinatorApp.main(args);
34      String output = "";
35      File fileIn = new File(fileName);
36      BufferedReader in = new BufferedReader( 
37          new InputStreamReader(
38              new FileInputStream(fileIn)));
39      int line = 0;
40      while (in.ready()) {
41        line++;
42        if (line == 1)
43          output += in.readLine();
44        else 
45          in.readLine();
46      }
47      in.close();
48  //    fileIn.delete();
49      assertEquals(
50          "// Delete this line to prevent overwriting of this file", output);
51    }
52  
53  }