1 /**
2 *
3 */
4 package org.melati.app.test;
5
6 import java.io.BufferedReader;
7 import java.io.File;
8 import java.io.FileInputStream;
9 import java.io.InputStreamReader;
10
11 import org.melati.app.DSDApp;
12
13 import junit.framework.TestCase;
14
15 /**
16 * @author timp
17 *
18 */
19 public class DSDAppTest extends TestCase {
20
21 /**
22 * @param name
23 */
24 public DSDAppTest(String name) {
25 super(name);
26 }
27
28 /**
29 * {@inheritDoc}
30 * @see junit.framework.TestCase#setUp()
31 */
32 protected void setUp() throws Exception {
33 super.setUp();
34 }
35
36 /**
37 * {@inheritDoc}
38 * @see junit.framework.TestCase#tearDown()
39 */
40 protected void tearDown() throws Exception {
41 super.tearDown();
42 }
43
44 /**
45 * Test method for {@link org.melati.app.AbstractConfigApp#run(java.lang.String[])}.
46 */
47 public void testRun() throws Exception {
48 String fileName = "t1.tmp";
49 String[] args = { "appjunit", "-o", fileName };
50 DSDApp.main(args);
51 String output = "";
52 File fileIn = new File(fileName);
53 BufferedReader in = new BufferedReader(
54 new InputStreamReader(
55 new FileInputStream(fileIn)));
56 int line = 0;
57 while (in.ready()) {
58 line++;
59 if (line == 2)
60 output += in.readLine();
61 else
62 in.readLine();
63 }
64 in.close();
65 fileIn.delete();
66 assertEquals(" * DSD for jdbc:hsqldb:mem:appjunit (org.melati.poem.PoemDatabase)" , output);
67 }
68
69 }