1 5 package com.tonbeller.wcf.popup; 6 7 import org.w3c.dom.Document ; 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 name) { 17 super(name); 18 } 19 20 protected void setUp() throws Exception { 21 tb = new TestBean(); 22 } 23 24 public void testPopUp0() throws Exception { 25 PopUp pu = tb.getPopUp0(); 26 Document 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 { 32 PopUp pu = tb.getPopUp1a(); 33 Document 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 { 40 PopUp pu = tb.getPopUp1b(); 41 Document 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 { 48 PopUp pu = tb.getPopUp2(); 49 Document 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 |