KickJava   Java API By Example, From Geeks To Geeks.

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


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 SchemaUtilsTest extends TestCase {
34
35     /**
36      * <p>
37      * This constructs a new <code>SchemaUtilsTest</code>.
38      * </p>
39      *
40      * @param name the name of the test case.
41      */

42     public SchemaUtilsTest(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(SchemaUtilsTest.class);
57     }
58
59     /**
60      * <p>
61      * This tests the <code>{@link SchemaUtils#getJavaType}</code> method.
62      * </p>
63      */

64     public void testGetJavaType() {
65         String JavaDoc xmlType = "string";
66         String JavaDoc javaType = "String";
67         
68         try {
69             assertEquals(javaType, SchemaUtils.getJavaType(xmlType));
70         } catch (UnsupportedSchemaTypeException e) {
71             assertTrue(false);
72         }
73     }
74     
75     /**
76      * <p>
77      * This tests the <code>{@link SchemaUtils#getJavaType}</code> method,
78      * in a negative fashion.
79      * </p>
80      */

81     public void testGetJavaTypeNegative() {
82         String JavaDoc xmlType = "someRandomType";
83         boolean caught = false;
84         
85         try {
86             String JavaDoc temp = SchemaUtils.getJavaType(xmlType);
87         } catch (UnsupportedSchemaTypeException e) {
88             caught = true;
89         }
90         assertTrue(caught);
91     }
92 }
93
Popular Tags