01: /*
02: * Copyright 2007 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.user.client.ui;
17:
18: import com.google.gwt.junit.client.GWTTestCase;
19:
20: /**
21: * TODO: document me.
22: */
23: public class HiddenTest extends GWTTestCase {
24:
25: public String getModuleName() {
26: return "com.google.gwt.user.User";
27: }
28:
29: public void testBadNames() {
30: try {
31: Hidden d = new Hidden("");
32: fail("expected illegal argument");
33: } catch (IllegalArgumentException e) {
34: // Expected
35: }
36: try {
37: Hidden d = new Hidden(null);
38: fail("expected null pointer exception");
39: } catch (NullPointerException e) {
40: // Expected
41: }
42: }
43:
44: public void testAtributes() {
45: Hidden x = new Hidden("test");
46: x.setDefaultValue("myDefaultValue");
47: assertEquals("myDefaultValue", x.getDefaultValue());
48: x.setValue("myValue");
49: assertEquals("myValue", x.getValue());
50: x.setID("myID");
51: assertEquals("myID", x.getID());
52:
53: x.setName("myName");
54: assertEquals("myName", x.getName());
55: }
56:
57: public void testConstructors() {
58: Hidden e = new Hidden();
59: assertEquals("", e.getName());
60: Hidden e2 = new Hidden("myName");
61: assertEquals("myName", e2.getName());
62: Hidden e3 = new Hidden("myName", "myValue");
63: assertEquals("myName", e3.getName());
64: assertEquals("myValue", e3.getValue());
65: }
66:
67: }
|