KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > swing > form > ComponentMapTest


1 /*
2  * Created on 23.02.2005
3  *
4  */

5 package org.jdesktop.swing.form;
6
7 import java.util.ArrayList JavaDoc;
8 import java.util.List JavaDoc;
9
10 import javax.swing.JComponent JavaDoc;
11 import javax.swing.ListModel JavaDoc;
12
13 import junit.framework.TestCase;
14
15 import org.jdesktop.swing.data.MetaData;
16
17 /**
18  * @author Jeanette Winzenburg
19  */

20 public class ComponentMapTest extends TestCase {
21
22     /**
23      * Issue #176: Problem with lookup of derived classes.
24      *
25      */

26     public void testAssignables() {
27         MetaData metaData = new MetaData("list", List JavaDoc.class);
28         JComponent JavaDoc listComp = ComponentMap.getInstance().createComponent(metaData);
29         MetaData arrayMetaData = new MetaData("array", Object JavaDoc[].class);
30         JComponent JavaDoc arrayComp = ComponentMap.getInstance().createComponent(arrayMetaData);
31         assertEquals("array and list must produce same component", listComp.getClass(), arrayComp.getClass());
32         MetaData arrayListMetaData = new MetaData("arrayList", ArrayList JavaDoc.class);
33         JComponent JavaDoc arrayListComp = ComponentMap.getInstance().createComponent(arrayListMetaData);
34         assertEquals("arrayList and list must produce same component", listComp.getClass(), arrayListComp.getClass());
35 //
36
// MetaData listModelMetaData = new MetaData("listModel", ListModel.class);
37
// JComponent listModelComp = ComponentMap.getInstance().createComponent(listModelMetaData);
38
// assertEquals("listModel and list must produce same component", listComp.getClass(), listModelComp.getClass());
39
}
40 }
41
Popular Tags