KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > L2ConfigForL1Test


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema;
5
6 import com.tc.test.EqualityChecker;
7 import com.tc.test.TCTestCase;
8
9 /**
10  * Unit test for {@link L2ConfigForL1}.
11  */

12 public class L2ConfigForL1Test extends TCTestCase {
13
14   public void testL2Data() throws Exception JavaDoc {
15     try {
16       new L2ConfigForL1.L2Data(null, 20);
17       fail("Didn't get NPE on no host");
18     } catch (NullPointerException JavaDoc npe) {
19       // ok
20
}
21
22     try {
23       new L2ConfigForL1.L2Data("", 20);
24       fail("Didn't get IAE on empty host");
25     } catch (IllegalArgumentException JavaDoc iae) {
26       // ok
27
}
28
29     try {
30       new L2ConfigForL1.L2Data(" ", 20);
31       fail("Didn't get IAE on blank host");
32     } catch (IllegalArgumentException JavaDoc iae) {
33       // ok
34
}
35
36     L2ConfigForL1.L2Data config = new L2ConfigForL1.L2Data("foobar", 20);
37     assertEquals("foobar", config.host());
38     assertEquals(20, config.dsoPort());
39
40     EqualityChecker.checkArraysForEquality(
41         new Object JavaDoc[] {
42                       new L2ConfigForL1.L2Data("foobar", 20),
43                       new L2ConfigForL1.L2Data("foobaz", 20),
44                       new L2ConfigForL1.L2Data("foobar", 2),
45                       new L2ConfigForL1.L2Data("foobar", 30) },
46         new Object JavaDoc[] {
47                       new L2ConfigForL1.L2Data("foobar", 20),
48                       new L2ConfigForL1.L2Data("foobaz", 20),
49                       new L2ConfigForL1.L2Data("foobar", 2),
50                       new L2ConfigForL1.L2Data("foobar", 30) });
51   }
52
53 }
54
Popular Tags