KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > cli > framework > ValidPropertyTest


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.cli.framework;
25
26 import junit.framework.*;
27 /**
28  *
29  * @author <a HREF="mailto:toby.h.ferguson@sun.com">Toby H Ferguson</a>
30  * @version $Revision: 1.4 $
31  */

32
33 public class ValidPropertyTest extends TestCase {
34     public void testValueMutation(){
35         ValidProperty vp = new ValidProperty("name", "value");
36         assertEquals("name", vp.getName());
37         assertEquals("value", vp.getValue());
38         vp.setValue("foo");
39         assertEquals("foo", vp.getValue());
40         assertEquals("name", vp.getName());
41     }
42
43     public void testNameMutation(){
44         ValidProperty vp = new ValidProperty("name", "value");
45         assertEquals("name", vp.getName());
46         assertEquals("value", vp.getValue());
47         vp.setName("foo");
48         assertEquals("foo", vp.getName());
49         assertEquals("value", vp.getValue());
50     }
51     public void testSimpleConstructor(){
52         ValidProperty vp = new ValidProperty("name", "value");
53         assertEquals("name", vp.getName());
54         assertEquals("value", vp.getValue());
55     }
56     
57
58     public void testEmptyConstructor() {
59         ValidProperty vp = new ValidProperty();
60         assertNull(vp.getName());
61     }
62
63     public ValidPropertyTest(String JavaDoc name){
64         super(name);
65     }
66
67     protected void setUp() {
68     }
69
70     protected void tearDown() {
71     }
72
73     private void nyi(){
74         fail("Not Yet Implemented");
75     }
76
77     public static void main(String JavaDoc args[]){
78         if (args.length == 0){
79             junit.textui.TestRunner.run(ValidPropertyTest.class);
80         } else {
81             junit.textui.TestRunner.run(makeSuite(args));
82         }
83     }
84     private static TestSuite makeSuite(String JavaDoc args[]){
85         final TestSuite ts = new TestSuite();
86         for (int i = 0; i < args.length; i++){
87             ts.addTest(new ValidPropertyTest(args[i]));
88         }
89         return ts;
90     }
91 }
92
Popular Tags