KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > UtilsTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.sun.share.configbean;
21
22 import javax.enterprise.deploy.spi.exceptions.ConfigurationException JavaDoc;
23 import junit.framework.TestCase;
24
25 /**
26  *
27  * @author vkraemer
28  */

29 public class UtilsTest extends TestCase {
30
31     /** Test of makeCE method, of class org.netbeans.modules.j2ee.sun.share.configbean.Utils. */
32     public void testMakeCE() {
33         ConfigurationException JavaDoc ce = Utils.makeCE(null, null, null);
34         assertEquals(ce.getMessage(),"ConfigurationException references unknown message key 'null' has params '{1}' '{2}' '{3}' '{4}' '{5}'");
35         ce = Utils.makeCE("ERR_UnexpectedRuntimeException", null, null);
36         assertEquals(ce.getMessage(),"Unexpected runtime exception");
37         ce = Utils.makeCE("unknownMessageKeyValue", null, null);
38         assertEquals(ce.getMessage(),"ConfigurationException references unknown message key 'unknownMessageKeyValue' has params '{1}' '{2}' '{3}' '{4}' '{5}'");
39         Object JavaDoc args[] = new Object JavaDoc[0];
40         ce = Utils.makeCE("ERR_UnexpectedRuntimeException", args, null);
41         assertEquals(ce.getMessage(),"Unexpected runtime exception");
42         ce = Utils.makeCE("unknownMessageKeyValue", args, null);
43         assertEquals(ce.getMessage(),"ConfigurationException references unknown message key 'unknownMessageKeyValue' has params '{1}' '{2}' '{3}' '{4}' '{5}'");
44         args = new Object JavaDoc[1];
45         ce = Utils.makeCE("unknownMessageKeyValue", args, null);
46         assertEquals(ce.getMessage(),"ConfigurationException references unknown message key 'unknownMessageKeyValue' has params 'null' '{2}' '{3}' '{4}' '{5}'");
47         args[0] = "Foobar";
48         ce = Utils.makeCE("unknownMessageKeyValue", args, null);
49         assertEquals(ce.getMessage(),"ConfigurationException references unknown message key 'unknownMessageKeyValue' has params 'Foobar' '{2}' '{3}' '{4}' '{5}'");
50     }
51
52     public UtilsTest(String JavaDoc testName) {
53         super(testName);
54     }
55     
56     /** Test of getFQNKey method, of class org.netbeans.modules.j2ee.sun.share.configbean.Utils.
57     public void testGetFQNKey() {
58         System.out.println("testGetFQNKey");
59         
60         // Add your test code below by replacing the default call to fail.
61         fail("The test case is empty.");
62     }
63     
64     /** Test of getUriFromKey method, of class org.netbeans.modules.j2ee.sun.share.configbean.Utils.
65     public void testGetUriFromKey() {
66         System.out.println("testGetUriFromKey");
67         
68         // Add your test code below by replacing the default call to fail.
69         fail("The test case is empty.");
70     }
71     
72     /** Test of getFilenameFromKey method, of class org.netbeans.modules.j2ee.sun.share.configbean.Utils.
73     public void testGetFilenameFromKey() {
74         System.out.println("testGetFilenameFromKey");
75         
76         // Add your test code below by replacing the default call to fail.
77         fail("The test case is empty.");
78     }
79     
80     */

81 }
82
Popular Tags