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.xml.test;
06:
07: import com.sun.portal.rewriter.test.util.BasicTestCase;
08: import com.sun.portal.rewriter.util.xml.Tag;
09: import com.sun.portal.rewriter.util.xml.TagParser;
10:
11: public class TestTag extends BasicTestCase {
12: public TestTag(String aName) {
13: super (aName);
14: }//constuctor
15:
16: public void testAttributeValues() {
17: String[][] lData = {
18: { "xml version=\"1.0\" encoding=\"MS932\"\n", "MS932", }, //0
19:
20: { "xml version=\"1.0\" encoding=\"MS932\" \t\n",
21: "MS932", }, //1
22:
23: { "xml version=\"1.0\" encoding=\"MS932\" \n",
24: "MS932", }, //2
25:
26: { "<?xml version=\"1.0\"?>\n", null, }, //3
27:
28: { "<?xml version=\"1.0\" ?>\n", null, }, //4
29:
30: { "<?xml version=\"1.0\" encoding=\"MS932\" ?>=10\n",
31: "MS932", }, //5
32:
33: { "<?xml version=\"1.0\" encoding=\"MS932\" ?>eeee\n",
34: "MS932\"", }, //6
35:
36: { "<?xml version=\"1.0\" encoding=\"MS932\" ?>\n",
37: "MS932\"", }, //7
38:
39: { "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n",
40: "ISO-8859-1\"", }, //8
41:
42: { "<?xml version=\"1.0\" encoding=\"URF-10\" ?>\n",
43: "URF-10\"", }, //9
44:
45: { "<?xml version=\"1.0\" encodING ?>\n", null, }, //10
46:
47: { "<?xml version=\"1.0\" encoding=\"MS932\"?>\n",
48: "MS932\"", }, //11
49:
50: { "<?xml version=\"1.0\" encoding=\"URF-10\"?>\n",
51: "URF-10\"", }, //12
52:
53: {
54: "<?xml version = \"1.0\" encoding = \"UTF-8\"?>\n",
55: "UTF-8\"" }, //13
56:
57: {
58: "<?xml version = \"1.0\" eNCoDinG = \"UTF-8\"?>\n",
59: "UTF-8\"" }, //14
60: };
61:
62: for (int i = 0; i < lData.length; i++) {
63: Tag t = TagParser.parse(lData[i][0], null);
64: assertEquals("Failed For i = " + i, lData[i][1], t
65: .get("encoDing"));
66: }
67: }//testAttributeValues()
68:
69: public static void main(String[] args) {
70: BasicTestCase.run(TestTag.class);
71: }//main()
72: }//class TestTag
|