KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ide > editors > CharsetDisplayPreferenceEditorTest


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.ide.editors;
21
22 import junit.framework.TestCase;
23
24 /**
25  *
26  * @author vkraemer
27  */

28 public class CharsetDisplayPreferenceEditorTest extends TestCase {
29
30     public void testGetSetAsString() {
31         CharsetDisplayPreferenceEditor foo =
32             new CharsetDisplayPreferenceEditor();
33
34         String JavaDoc ret = null;
35         foo.setAsText(foo.choices[0]);
36         ret = foo.getAsText();
37         assertEquals(foo.choices[0], ret);
38         foo.setAsText(foo.choices[1]);
39         ret = foo.getAsText();
40         assertEquals(foo.choices[1], ret);
41         foo.setAsText(foo.choices[2]);
42         ret = foo.getAsText();
43         assertEquals(foo.choices[2], ret);
44         foo.setAsText("bogus");
45         ret = foo.getAsText();
46         assertEquals(foo.choices[1], ret);
47     }
48         
49     
50     public void testGetSet() {
51         CharsetDisplayPreferenceEditor foo =
52             new CharsetDisplayPreferenceEditor();
53
54         Integer JavaDoc ret = null;
55         foo.setValue(Integer.valueOf("0"));
56         ret = (Integer JavaDoc) foo.getValue();
57         assertEquals(Integer.valueOf("0"), ret);
58         foo.setValue(Integer.valueOf("1"));
59         ret = (Integer JavaDoc) foo.getValue();
60         assertEquals(Integer.valueOf("1"),ret);
61         foo.setValue(Integer.valueOf("2"));
62         ret = (Integer JavaDoc) foo.getValue();
63         assertEquals(Integer.valueOf("2"), ret);
64         foo.setValue(Integer.valueOf("3"));
65         ret = (Integer JavaDoc) foo.getValue();
66         assertEquals(Integer.valueOf("1"),ret);
67         foo.setValue(Integer.valueOf("-1"));
68         ret = (Integer JavaDoc) foo.getValue();
69         assertEquals(Integer.valueOf("1"), ret );
70         
71     }
72         
73     
74     public void testCreate() {
75         CharsetDisplayPreferenceEditor foo =
76             new CharsetDisplayPreferenceEditor();
77     }
78     
79     public CharsetDisplayPreferenceEditorTest(String JavaDoc testName) {
80         super(testName);
81     }
82     
83 }
84
Popular Tags