source: josm/trunk/test/unit/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCellTest.java@ 18037

Last change on this file since 18037 was 18037, checked in by Don-vip, 3 years ago

fix #21064 - Add JUnit 5 extension for preferences (patch by taylor.smock)

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.io;
3
4import static org.junit.jupiter.api.Assertions.assertEquals;
5import static org.junit.jupiter.api.Assertions.assertNull;
6import static org.junit.jupiter.api.Assertions.assertTrue;
7
8import java.io.File;
9
10import javax.swing.JTable;
11
12import org.junit.jupiter.api.Test;
13import org.openstreetmap.josm.data.osm.DataSet;
14import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
15import org.openstreetmap.josm.gui.layer.OsmDataLayer;
16import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
17
18/**
19 * Unit tests of {@link LayerNameAndFilePathTableCell} class.
20 */
21@BasicPreferences
22class LayerNameAndFilePathTableCellTest {
23 /**
24 * Test of {@link LayerNameAndFilePathTableCell} class.
25 */
26 @Test
27 void testLayerNameAndFilePathTableCell() {
28 JTable table = new JTable();
29 File file = new File("test");
30 String name = "layername";
31 AbstractModifiableLayer layer = new OsmDataLayer(new DataSet(), name, file);
32 SaveLayerInfo value = new SaveLayerInfo(layer);
33 LayerNameAndFilePathTableCell c = new LayerNameAndFilePathTableCell();
34 assertEquals(c, c.getTableCellEditorComponent(table, value, false, 0, 0));
35 assertEquals(c, c.getTableCellRendererComponent(table, value, false, false, 0, 0));
36 assertTrue(c.isCellEditable(null));
37 assertTrue(c.shouldSelectCell(null));
38 assertNull(c.getCellEditorValue());
39 assertTrue(c.stopCellEditing());
40 assertEquals(file, c.getCellEditorValue());
41 }
42}
Note: See TracBrowser for help on using the repository browser.