KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > junitdoclet > PackageListerTest


1 package org.junitdoclet;
2
3 import junit.framework.TestCase;
4 // JUnitDoclet begin import
5
import org.junitdoclet.PackageLister;
6 // JUnitDoclet end import
7

8 /**
9 * Generated by JUnitDoclet, a tool provided by
10 * ObjectFab GmbH under LGPL.
11 * Please see www.junitdoclet.org, www.gnu.org
12 * and www.objectfab.de for informations about
13 * the tool, the licence and the authors.
14 */

15
16
17 public class PackageListerTest
18 // JUnitDoclet begin extends_implements
19
extends TestCase
20 // JUnitDoclet end extends_implements
21
{
22   // JUnitDoclet begin class
23
PackageLister packagelister = null;
24   // JUnitDoclet end class
25

26   public PackageListerTest(String JavaDoc name) {
27     // JUnitDoclet begin method PackageListerTest
28
super(name);
29     // JUnitDoclet end method PackageListerTest
30
}
31   
32   public org.junitdoclet.PackageLister createInstance() {
33     // JUnitDoclet begin method testcase.createInstance
34
return new PackageLister();
35     // JUnitDoclet end method testcase.createInstance
36
}
37   
38   protected void setUp() throws Exception JavaDoc {
39     // JUnitDoclet begin method testcase.setUp
40
super.setUp();
41     packagelister = createInstance();
42     // JUnitDoclet end method testcase.setUp
43
}
44   
45   protected void tearDown() throws Exception JavaDoc {
46     // JUnitDoclet begin method testcase.tearDown
47
packagelister = null;
48     super.tearDown();
49     // JUnitDoclet end method testcase.tearDown
50
}
51   
52   public void testInit() throws Exception JavaDoc {
53     // JUnitDoclet begin method init
54
packagelister.init();
55       assertEquals(null, packagelister.getOutput());
56       assertEquals(null, packagelister.getPath());
57       assertEquals(null, packagelister.getTopPackage());
58     // JUnitDoclet end method init
59
}
60   
61   public void testSetGetOutput() throws Exception JavaDoc {
62     // JUnitDoclet begin method setOutput getOutput
63
String JavaDoc[] tests = {"", " ", "a", "A", "ä", "ß", "0123456789", "012345678901234567890", "\n", null};
64
65     for (int i = 0; i < tests.length; i++) {
66       packagelister.setOutput(tests[i]);
67       assertEquals(tests[i], packagelister.getOutput());
68     }
69     // JUnitDoclet end method setOutput getOutput
70
}
71   
72   public void testSetGetTopPackage() throws Exception JavaDoc {
73     // JUnitDoclet begin method setTopPackage getTopPackage
74
String JavaDoc[] tests = {"", " ", "a", "A", "ä", "ß", "0123456789", "012345678901234567890", "\n", null};
75
76     for (int i = 0; i < tests.length; i++) {
77       packagelister.setTopPackage(tests[i]);
78       assertEquals(tests[i], packagelister.getTopPackage());
79     }
80     // JUnitDoclet end method setTopPackage getTopPackage
81
}
82   
83   public void testSetGetPath() throws Exception JavaDoc {
84     // JUnitDoclet begin method setPath getPath
85
String JavaDoc[] tests = {"", " ", "a", "A", "ä", "ß", "0123456789", "012345678901234567890", "\n", null};
86
87     for (int i = 0; i < tests.length; i++) {
88       packagelister.setPath(tests[i]);
89       assertEquals(tests[i], packagelister.getPath());
90     }
91     // JUnitDoclet end method setPath getPath
92
}
93   
94   public void testProcessArgs() throws Exception JavaDoc {
95     // JUnitDoclet begin method processArgs
96
String JavaDoc[] ARGS_MIN = {"."};
97       String JavaDoc[] ARGS_WITH_OUTPUT_1 = {"-o", "package.txt", "."};
98       String JavaDoc[] ARGS_WITH_OUTPUT_2 = {".", "-o", "package.txt"};
99       String JavaDoc[] ARGS_WITH_OUTPUT_3 = {"-o", "."};
100       String JavaDoc[] ARGS_WITH_OUTPUT_4 = {".", "-o"};
101       String JavaDoc[] ARGS_WITH_OUTPUT_5 = {"-o"};
102       String JavaDoc[] ARGS_WITH_TOP_1 = {".", "-top", "*"};
103       String JavaDoc[] ARGS_WITH_TOP_2 = {".", "-top", "com"};
104       String JavaDoc[] ARGS_WITH_TOP_3 = {".", "-top", "com.objectfab"};
105       String JavaDoc[] ARGS_WITH_TOP_4 = {"-top", "*", "."};
106       String JavaDoc[] ARGS_WITH_TOP_5 = {".", "-top"};
107       String JavaDoc[] ARGS_WITH_TOP_6 = {"-top"};
108       String JavaDoc[] ARGS_WITH_ALL_1 = {"-top", "*", ".", "-o", "packages.txt"};
109       String JavaDoc[] ARGS_WITH_ALL_2 = {".", "-top", "*", "-o", "packages.txt"};
110       String JavaDoc[] ARGS_WITH_ALL_3 = {".", "-o", "packages.txt", "-top", "*"};
111
112       assertEquals(true, packagelister.processArgs(ARGS_MIN));
113       assertEquals(true, packagelister.processArgs(ARGS_WITH_OUTPUT_1));
114       assertEquals(true, packagelister.processArgs(ARGS_WITH_OUTPUT_2));
115       assertEquals(false, packagelister.processArgs(ARGS_WITH_OUTPUT_3));
116       assertEquals(false, packagelister.processArgs(ARGS_WITH_OUTPUT_4));
117       assertEquals(false, packagelister.processArgs(ARGS_WITH_OUTPUT_5));
118       assertEquals(true, packagelister.processArgs(ARGS_WITH_TOP_1));
119       assertEquals(true, packagelister.processArgs(ARGS_WITH_TOP_2));
120       assertEquals(true, packagelister.processArgs(ARGS_WITH_TOP_3));
121       assertEquals(true, packagelister.processArgs(ARGS_WITH_TOP_4));
122       assertEquals(false, packagelister.processArgs(ARGS_WITH_TOP_5));
123       assertEquals(false, packagelister.processArgs(ARGS_WITH_TOP_6));
124       assertEquals(true, packagelister.processArgs(ARGS_WITH_ALL_1));
125       assertEquals(true, packagelister.processArgs(ARGS_WITH_ALL_2));
126       packagelister.init();
127       assertEquals(true, packagelister.processArgs(ARGS_WITH_ALL_3));
128       assertEquals("*", packagelister.getTopPackage());
129       assertEquals("packages.txt", packagelister.getOutput());
130       assertEquals(".", packagelister.getPath());
131     // JUnitDoclet end method processArgs
132
}
133   
134   public void testExecute() throws Exception JavaDoc {
135     // JUnitDoclet begin method execute
136
// JUnitDoclet end method execute
137
}
138   
139   public void testMain() throws Exception JavaDoc {
140     // JUnitDoclet begin method main
141
// JUnitDoclet end method main
142
}
143   
144   public void testPrintUsage() throws Exception JavaDoc {
145     // JUnitDoclet begin method printUsage
146
// JUnitDoclet end method printUsage
147
}
148   
149   public void testCollectPackages() throws Exception JavaDoc {
150     // JUnitDoclet begin method collectPackages
151
// JUnitDoclet end method collectPackages
152
}
153   
154   public void testWritePackages() throws Exception JavaDoc {
155     // JUnitDoclet begin method writePackages
156
// JUnitDoclet end method writePackages
157
}
158   
159   
160   
161   /**
162   * JUnitDoclet moves marker to this method, if there is not match
163   * for them in the regenerated code and if the marker is not empty.
164   * This way, no test gets lost when regenerating after renaming.
165   * Method testVault is supposed to be empty.
166   */

167   public void testVault() throws Exception JavaDoc {
168     // JUnitDoclet begin method testcase.testVault
169
// JUnitDoclet end method testcase.testVault
170
}
171   
172   public static void main(String JavaDoc[] args) {
173     // JUnitDoclet begin method testcase.main
174
junit.textui.TestRunner.run(PackageListerTest.class);
175     // JUnitDoclet end method testcase.main
176
}
177 }
178
Popular Tags