KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > zeus > util > XMLNameTest


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  */

19 package org.enhydra.zeus.util;
20
21 // JUnit imports
22
import junit.framework.Test;
23 import junit.framework.TestCase;
24 import junit.framework.TestSuite;
25
26 /**
27  * <p>
28  * This is a test case for the <code>{@link SchemaUtils}</code> class.
29  * </p>
30  *
31  * @author Brett McLaughlin
32  */

33 public class XMLNameTest extends TestCase {
34
35     /**
36      * <p>
37      * This constructs a new <code>XMLNameTest</code>.
38      * </p>
39      *
40      * @param name the name of the test case.
41      */

42     public XMLNameTest(String JavaDoc name) {
43         super(name);
44     }
45
46     /**
47      * <p>
48      * This method maeks it easier to call these
49      * tests dynamically.
50      * </p>
51      *
52      * @return <code>TestSuite</code> - corresponds to this
53      * <code>TestCase</code>.
54      */

55     public static Test suite(){
56         return new TestSuite(XMLNameTest.class);
57     }
58     
59     /**
60      * <p>
61      * This creates a new <code>{@link XMLName}</code> object for testing.
62      * </p>
63      *
64      * @return <code>XMLName</code> - the created <code>XMLName</code> object.
65      */

66     protected XMLName getXMLName() {
67         return new XMLName("dummyName", "dummyURI");
68     }
69
70     /**
71      * <p>
72      * This tests the <code>{@link XMLName#getXMLName}</code> method.
73      * </p>
74      */

75     public void testGetXMLName() {
76         XMLName xmlName = getXMLName();
77         String JavaDoc name = "xmlName";
78         xmlName.setXMLName(name);
79         assertEquals(name, xmlName.getXMLName());
80     }
81     
82     /**
83      * <p>
84      * This tests the <code>{@link XMLName#setXMLName}</code> method.
85      * </p>
86      */

87     public void testSetXMLName() {
88         XMLName xmlName = getXMLName();
89         String JavaDoc name = "xmlName";
90         xmlName.setXMLName(name);
91         assertEquals(name, xmlName.getXMLName());
92         
93         name = "newName";
94         xmlName.setXMLName(name);
95         assertEquals(name, xmlName.getXMLName());
96     }
97     
98     /**
99      * <p>
100      * This tests the <code>{@link XMLName#getNamespaceURI}</code> method,
101      * in a negative fashion.
102      * </p>
103      */

104     public void testGetNamespaceURI() {
105         XMLName xmlName = getXMLName();
106         String JavaDoc namespaceURI = "http://www.namespace.com";
107         xmlName.setNamespaceURI(namespaceURI);
108         assertEquals(namespaceURI, xmlName.getNamespaceURI());
109     }
110     
111     /**
112      * <p>
113      * This tests the <code>{@link XMLName#setNamespaceURI}</code> method.
114      * </p>
115      */

116     public void testSetNamespaceURI() {
117         XMLName xmlName = getXMLName();
118         String JavaDoc namespaceURI = "http://www.namespace.com";
119         xmlName.setNamespaceURI(namespaceURI);
120         assertEquals(namespaceURI, xmlName.getNamespaceURI());
121         
122         namespaceURI = "http://www.newNamespace.com";
123         xmlName.setNamespaceURI(namespaceURI);
124         assertEquals(namespaceURI, xmlName.getNamespaceURI());
125     }
126 }
127
Popular Tags