KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > webui > list > DefaultWebListCellRendererTest


1 /*
2 Copyright (c) 2003 eInnovation Inc. All rights reserved
3
4 This library is free software; you can redistribute it and/or modify it under the terms
5 of the GNU Lesser General Public License as published by the Free Software Foundation;
6 either version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the GNU Lesser General Public License for more details.
11 */

12
13 package com.openedit.webui.list;
14
15 import junit.framework.TestCase;
16
17 import org.dom4j.DocumentFactory;
18 import org.dom4j.Element;
19
20
21 /**
22  * Test for UserListCellRenderer
23  *
24  * @author Eric Galluzzo
25  */

26 public class DefaultWebListCellRendererTest extends TestCase
27 {
28     protected DefaultWebListCellRenderer fieldRenderer;
29
30     public DefaultWebListCellRendererTest(String JavaDoc inName)
31     {
32         super(inName);
33     }
34
35     /**
36          *
37          */

38     public void testGetListCellElement()
39     {
40         DefaultWebListNode node = new DefaultWebListNode("Hi mom", "foo.html", "path/to/my/icon");
41         Element elem = fieldRenderer.getListCellElement(null, node, DocumentFactory.getInstance());
42
43         // DefaultWebListNode-specific attributes
44
assertEquals("Hi mom", elem.element(DefaultWebListCellRenderer.NAME_QNAME).getText());
45         assertEquals("foo.html", elem.attributeValue("url"));
46         assertEquals("path/to/my/icon", elem.attributeValue("icon-url"));
47     }
48
49     /*
50      * @see TestCase#setUp()
51      */

52     protected void setUp() throws Exception JavaDoc
53     {
54         fieldRenderer = new DefaultWebListCellRenderer();
55     }
56 }
57
Popular Tags