KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > utils > TestOptions


1 package test.utils;
2
3 import junit.framework.Test;
4 import junit.framework.TestCase;
5 import junit.framework.TestSuite;
6 import org.apache.axis.utils.Options;
7
8 import java.net.MalformedURLException JavaDoc;
9
10 public class TestOptions extends TestCase
11 {
12     public TestOptions (String JavaDoc name) {
13         super(name);
14     }
15
16     public static Test suite() {
17         return new TestSuite(TestOptions.class);
18     }
19
20     protected void setup() {
21     }
22
23     public void testOptionsConstructor() throws MalformedURLException JavaDoc
24     {
25         String JavaDoc[] fake_args = { "-h 127.0.0.1","-p 8081","-u scott","-w tiger" };
26         Options ops = new Options(fake_args);
27     }
28
29
30     /*
31     * Note - by Java conventions, the isFlagSet and isValueSet should either
32     * return a boolean value, or be given more descriptive names. I might
33     * suggest getFlagFrequency and getArgValue or something.
34     */

35     public void testIsFlagSet() throws MalformedURLException JavaDoc
36     {
37         String JavaDoc[] fake_args = { "-w tiger" };
38         Options ops = new Options(fake_args);
39         String JavaDoc result = ops.isValueSet('w');
40         assertEquals("Result was: " + result + ", not tiger", "tiger", result);
41     }
42
43 }
44
Popular Tags