01: package org.apache.lucene.swing.models;
02:
03: /**
04: * Copyright 2005 The Apache Software Foundation
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.util.ArrayList;
20:
21: import javax.swing.table.TableModel;
22:
23: import junit.framework.TestCase;
24:
25: /**
26: * @author Jonathan Simon - jonathan_s_simon@yahoo.com
27: */
28: public class TestBasicTable extends TestCase {
29: private TableModel baseTableModel;
30: private TableSearcher tableSearcher;
31: private ArrayList list;
32:
33: protected void setUp() throws Exception {
34: list = new ArrayList();
35: list.add(DataStore.canolis);
36: list.add(DataStore.chris);
37:
38: baseTableModel = new BaseTableModel(list.iterator());
39: tableSearcher = new TableSearcher(baseTableModel);
40: }
41:
42: public void testColumns() {
43:
44: assertEquals(baseTableModel.getColumnCount(), tableSearcher
45: .getColumnCount());
46: assertEquals(baseTableModel.getColumnName(0), tableSearcher
47: .getColumnName(0));
48: assertNotSame(baseTableModel.getColumnName(0), tableSearcher
49: .getColumnName(1));
50: assertEquals(baseTableModel.getColumnClass(0), tableSearcher
51: .getColumnClass(0));
52: }
53:
54: public void testRows() {
55: assertEquals(list.size(), tableSearcher.getRowCount());
56: }
57:
58: public void testValueAt() {
59: assertEquals(baseTableModel.getValueAt(0, 0), tableSearcher
60: .getValueAt(0, 0));
61: assertEquals(baseTableModel.getValueAt(0, 3), tableSearcher
62: .getValueAt(0, 3));
63: }
64:
65: }
|