1 12 13 package com.openedit.webui.list; 14 15 import javax.swing.DefaultListModel ; 16 17 import junit.framework.TestCase; 18 19 import org.dom4j.Document; 20 21 22 27 public class WebListTest extends TestCase 28 { 29 protected WebList fieldWebList; 30 31 public WebListTest(String inName) 32 { 33 super(inName); 34 } 35 36 41 public void testRender() throws Exception  42 { 43 Document doc = fieldWebList.render(); 44 assertEquals( 45 46 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + 48 "<list:list xmlns:list=\"http://www.einnovation.com/xmlns/WebUI/List\">" + 49 "<list:node url=\"first-node.html\">" + "<list:name>First node</list:name>" + 50 "</list:node>" + "</list:list>", doc.asXML()); 51 } 52 53 58 public void testRender_WithName() throws Exception  59 { 60 fieldWebList.setName("foo"); 61 62 Document doc = fieldWebList.render(); 63 assertEquals( 64 65 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + 67 "<list:list xmlns:list=\"http://www.einnovation.com/xmlns/WebUI/List\" name=\"foo\">" + 68 "<list:node url=\"first-node.html\">" + "<list:name>First node</list:name>" + 69 "</list:node>" + "</list:list>", doc.asXML()); 70 } 71 72 75 protected void setUp() throws Exception  76 { 77 DefaultListModel model = new DefaultListModel (); 78 DefaultWebListNode node = new DefaultWebListNode("First node", "first-node.html"); 79 model.addElement(node); 80 fieldWebList = new WebList(model); 81 fieldWebList.setCellRenderer(new DefaultWebListCellRenderer()); 82 } 83 } 84 | Popular Tags |