01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rewriter.util.clip.test;
06:
07: import com.sun.portal.rewriter.test.util.BasicTestCase;
08: import com.sun.portal.rewriter.util.clip.CLIPConstants;
09: import com.sun.portal.rewriter.util.clip.CLIPOption;
10: import com.sun.portal.rewriter.util.clip.CLIPSpec;
11: import junit.framework.TestCase;
12:
13: public class TestCLIPOption extends TestCase {
14: public TestCLIPOption(String s) {
15: super (s);
16: }//constructor
17:
18: public void setUp() throws Exception {
19: CLIPSpec.getCLIArgs(new String[] { "resources/RWCLISpec.xml",
20: "psrwCLI" });
21: }//setUp()
22:
23: public void testDefaultValuesCollection() {
24: try {
25: new CLIPOption("version", "", CLIPConstants.COLLECTION,
26: "a b c d e", "TestMessage");
27: fail("Exception of Type IllegalArgumentException is not thrown ");
28: } catch (IllegalArgumentException e) {
29: assertTrue(true);
30: return;
31: }
32: }//testDefaultValuesCollection()
33:
34: public void testDefaultValuesBoolean0() {
35: try {
36: new CLIPOption("version", "v", CLIPConstants.BOOLEAN,
37: "a b c d e", "TestMessage");
38:
39: } catch (IllegalArgumentException e) {
40: assertTrue(true);
41: return;
42: }
43: }//testDefaultValuesBoolean0()
44:
45: public void testDefaultValuesBooleanFalse() {
46: try {
47: new CLIPOption("version", "v", CLIPConstants.BOOLEAN,
48: "false", "optionHelp");
49: assertTrue(true);
50: } catch (Exception e) {
51: assertTrue(false);
52: }
53: }//testDefaultValuesBooleanFalse()
54:
55: public void testDefaultValuesBooleanWithSpaceTrue() {
56: try {
57: new CLIPOption("version", "v", CLIPConstants.BOOLEAN,
58: " true ", "optionHelp");
59: assertTrue(true);
60: } catch (Exception e) {
61: assertTrue(false);
62: }
63: }//testDefaultValuesBooleanWithSpaceTrue()
64:
65: public static void main(String[] args) {
66: BasicTestCase.run(TestCLIPOption.class);
67: }//main()
68: }//class TestCLIPOption
|