01: /*
02: * This file or a portion of this file is licensed under the terms of
03: * the Globus Toolkit Public License, found in file GTPL, or at
04: * http://www.globus.org/toolkit/download/license.html. This notice must
05: * appear in redistributions of this file, with or without modification.
06: *
07: * Redistributions of this Software, with or without modification, must
08: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
09: * some other similar material which is provided with the Software (if
10: * any).
11: *
12: * Copyright 1999-2004 University of Chicago and The University of
13: * Southern California. All rights reserved.
14: */
15:
16: package org.griphyn.common.util;
17:
18: /**
19: * This is the test program for the Separator class.
20: *
21: * @author Jens-S. Vöckler
22: * @author Yong Zhao
23: * @version $Revision: 50 $
24: *
25: * @see org.griphyn.vdl.classes.Definition
26: */
27: public class SeparatorTest {
28: public static void show(String what) {
29: System.out.print(what + " => [");
30: try {
31: String[] x = Separator.split(what);
32: for (int i = 0; i < x.length; ++i) {
33: System.out.print(Integer.toString(i) + ':');
34: System.out.print(x[i] == null ? "null" : "\"" + x[i]
35: + "\"");
36: if (i < x.length - 1)
37: System.out.print(", ");
38: }
39: } catch (IllegalArgumentException iae) {
40: System.out.print(iae.getMessage());
41: }
42: System.out.println(']');
43: }
44:
45: public static void main(String[] args) {
46: if (args.length > 0) {
47: for (int i = 0; i < args.length; ++i)
48: show(args[i]);
49: } else {
50: show("test");
51: show("test::me");
52: show("test:me");
53: show("test::me:too");
54: show("illegal:::too");
55:
56: show("test::me:a,b");
57: show("test::me:,b");
58: show("test::me:a,");
59: show("il::legal:,"); // illegal spec
60:
61: show("me:a,b");
62: show("me:,b");
63: show("me:a,");
64: show("illegal:,"); // illegal spec
65:
66: show(":::,"); // illegal spec
67: }
68: }
69: }
|