KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > popup > PopUpTest


1 /*
2  * Copyright (c) 1971-2003 TONBELLER AG, Bensheim.
3  * All rights reserved.
4  */

5 package com.tonbeller.wcf.popup;
6
7 import org.w3c.dom.Document JavaDoc;
8
9 import com.tonbeller.tbutils.xmlunit.XmlTestCase;
10 import com.tonbeller.wcf.controller.RequestContext;
11
12 public class PopUpTest extends XmlTestCase {
13   TestBean tb;
14   
15   
16   public PopUpTest(String JavaDoc name) {
17     super(name);
18   }
19   
20   protected void setUp() throws Exception JavaDoc {
21     tb = new TestBean();
22   }
23
24   public void testPopUp0() throws Exception JavaDoc {
25     PopUp pu = tb.getPopUp0();
26     Document JavaDoc dom = pu.render((RequestContext)null);
27     assertNodeCount(dom, "/popup-menu/popup-group", 0);
28     assertNodeCount(dom, "/popup-menu/popup-item", 2);
29   }
30   
31   public void testPopUp1a() throws Exception JavaDoc {
32     PopUp pu = tb.getPopUp1a();
33     Document JavaDoc dom = pu.render((RequestContext)null);
34     assertNodeCount(dom, "/popup-menu[@id]/popup-group", 1);
35     assertNodeCount(dom, "/popup-menu/popup-item", 0);
36     assertNodeCount(dom, "/popup-menu/popup-group/popup-item", 2);
37   }
38
39   public void testPopUp1b() throws Exception JavaDoc {
40     PopUp pu = tb.getPopUp1b();
41     Document JavaDoc dom = pu.render((RequestContext)null);
42     assertNodeCount(dom, "/popup-menu/popup-group", 1);
43     assertNodeCount(dom, "/popup-menu/popup-item", 0);
44     assertNodeCount(dom, "/popup-menu/popup-group/popup-item", 2);
45   }
46
47   public void testPopUp2() throws Exception JavaDoc {
48     PopUp pu = tb.getPopUp2();
49     Document JavaDoc dom = pu.render((RequestContext)null);
50     assertNodeCount(dom, "/popup-menu/popup-group[@label='Group 1']/popup-item", 2);
51     assertNodeCount(dom, "/popup-menu/popup-group[@label='Group 2']/popup-item", 2);
52     assertNodeCount(dom, "/popup-menu/popup-group[@label='Group 3']", 0);
53     assertNodeCount(dom, "/popup-menu/popup-group[@label='Group 4']/popup-item", 6);
54     assertNodeCount(dom, "/popup-menu/popup-group[@label='Group 4']/popup-group", 2);
55   }
56
57 }
58
Popular Tags