KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > swing > data > DMToTableModelAdapterTest


1 /*
2  * $Id: DMToTableModelAdapterTest.java,v 1.1 2005/03/01 13:25:00 kleopatra Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7 package org.jdesktop.swing.data;
8
9 import javax.swing.table.TableModel JavaDoc;
10
11 import junit.framework.TestCase;
12
13 import org.jdesktop.swing.util.DataSetTestSupport;
14
15 /**
16  * Test DataModelToTableModelAdapter.
17  *
18  * @author Jeanette Winzenburg
19  */

20 public class DMToTableModelAdapterTest extends TestCase {
21
22     
23     
24     private MetaData[] defaultMetaData;
25
26     public void testColumnName() {
27         TableModel JavaDoc adapter = new DataModelToTableModelAdapter(createFilledDataModel());
28         for (int i = 0; i < defaultMetaData.length; i++) {
29             assertEquals("column name must be equal to metadata label",
30                     defaultMetaData[i].getLabel(), adapter.getColumnName(i));
31         }
32     }
33     protected TabularDataModel createFilledDataModel() {
34         return DataSetTestSupport.createDefaultFilledTabularDataModel(3);
35         
36     }
37
38     protected void setUp() throws Exception JavaDoc {
39         super.setUp();
40         defaultMetaData = DataSetTestSupport.createDefaultMetaData();
41     }
42 }
43
Popular Tags