KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdnc > markup > TreeTableTest


1 /*
2  * $Id: TreeTableTest.java,v 1.1 2004/10/13 07:09:41 davidson1 Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7
8 package org.jdesktop.jdnc.markup;
9
10 import java.net.URL JavaDoc;
11 import java.net.MalformedURLException JavaDoc;
12
13 import javax.swing.SwingConstants JavaDoc;
14
15 import junit.framework.TestCase;
16
17 import net.openmarkup.ObjectRealizer;
18
19 import org.jdesktop.jdnc.markup.ElementTypes;
20
21 import org.jdesktop.jdnc.JNTreeTable;
22
23 /**
24  * Unit test for treeTable element
25  */

26 public class TreeTableTest extends TestCase {
27
28     private ObjectRealizer realizer;
29
30     protected void setUp() {
31         realizer = RealizerUnitTest.createObjectRealizer();
32         realizer.add(ElementTypes.get());
33     }
34
35     protected void tearDown() {
36         realizer = null;
37     }
38
39     /**
40      * Simple utility to verify the URL and table object.
41      */

42     private JNTreeTable getTreeTable(String JavaDoc resource) throws Exception JavaDoc {
43         URL JavaDoc url = RealizerUnitTest.class.getResource(resource);
44         assertNotNull(url);
45
46         Object JavaDoc obj = realizer.getObject(url);
47         assertNotNull(obj);
48         assertTrue(obj.getClass().toString() + " is not a JNTreeTable",
49                    obj instanceof JNTreeTable);
50
51         return (JNTreeTable) obj;
52     }
53
54
55     /**
56      * Verify that the basic test data will create tables. All new table test cases
57      * should be placed here.
58      */

59     public void testTreeTable() throws Exception JavaDoc {
60         getTreeTable("resources/treetable00.xml");
61     }
62 }
63
64
65
Popular Tags