source: josm/trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ListEditorTest.java@ 16160

Last change on this file since 16160 was 10378, checked in by Don-vip, 8 years ago

Checkstyle 6.19: enable SingleSpaceSeparator and fix violations

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.preferences.advanced;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertNotNull;
6import static org.junit.Assert.assertTrue;
7
8import java.util.Arrays;
9
10import org.junit.BeforeClass;
11import org.junit.Test;
12import org.openstreetmap.josm.JOSMFixture;
13import org.openstreetmap.josm.gui.preferences.advanced.ListEditor.ListSettingTableModel;
14
15/**
16 * Unit tests of {@link ListEditor} class.
17 */
18public class ListEditorTest {
19
20 /**
21 * Setup test.
22 */
23 @BeforeClass
24 public static void setUpBeforeClass() {
25 JOSMFixture.createUnitTestFixture().init();
26 }
27
28 /**
29 * Unit test of {@link ListSettingTableModel} class.
30 */
31 @Test
32 public void testListSettingTableModel() {
33 ListSettingTableModel model = new ListSettingTableModel(null);
34 assertNotNull(model.getData());
35 model = new ListSettingTableModel(Arrays.asList("foo"));
36 assertTrue(model.getData().contains("foo"));
37 assertEquals(2, model.getRowCount());
38 assertEquals(1, model.getColumnCount());
39 assertEquals("foo", model.getValueAt(0, 0));
40 assertEquals("", model.getValueAt(1, 0));
41 assertTrue(model.isCellEditable(0, 0));
42 model.setValueAt("bar", 0, 0);
43 assertEquals("bar", model.getValueAt(0, 0));
44 model.setValueAt("test", 1, 0);
45 assertEquals("test", model.getValueAt(1, 0));
46 assertEquals(3, model.getRowCount());
47 }
48}
Note: See TracBrowser for help on using the repository browser.