KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: DefaultTableModelExtIssues.java,v 1.1 2005/01/27 14:40:28 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 junit.framework.TestCase;
10
11 /**
12  * JUnit test class for exposing open issues with
13  * tabular data model.
14  *
15  * @author Jeanette Winzenburg
16  */

17 public class DefaultTableModelExtIssues extends TestCase {
18
19     /**
20      * Issue #90: DefaultTableModelExt must not introduce
21      * precondition to setValueAt(..)
22      *
23      */

24     public void testSetValueContract() {
25         DefaultTableModelExt model = new DefaultTableModelExt(1);
26         MetaData metaData = new MetaData("one");
27         metaData.setReadOnly(true);
28         model.setColumnMetaData(0, metaData);
29         model.addRow(new Object JavaDoc[] {"non-editable value"});
30         assertFalse("cell must be uneditable", model.isCellEditable(0, 0));
31         try {
32             model.setValueAt("changed", 0, 0);
33         } catch (RuntimeException JavaDoc ex) {
34             fail("must not introduce precondition");
35         }
36     }
37 }
38
Popular Tags