source: josm/trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialogTest.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: 2.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.conflict.tags;
3
4import static org.junit.jupiter.api.Assertions.assertEquals;
5import static org.junit.jupiter.api.Assertions.assertFalse;
6import static org.junit.jupiter.api.Assertions.assertNotNull;
7import static org.junit.jupiter.api.Assertions.assertNull;
8
9import java.awt.Insets;
10
11import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
12import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfo;
13import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfoTable;
14import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsTableModel;
15import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
16
17import org.junit.jupiter.api.Test;
18
19/**
20 * Unit tests of {@link PasteTagsConflictResolverDialog} class.
21 */
22// Needed to due to OSM primitive dependencies
23@BasicPreferences
24class PasteTagsConflictResolverDialogTest {
25 /**
26 * Unit test of {@link PasteTagsConflictResolverDialog#PANE_TITLES}.
27 */
28 @Test
29 void testPaneTitles() {
30 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES);
31 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.NODE));
32 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.WAY));
33 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.RELATION));
34 }
35
36 /**
37 * Unit test of {@link PasteTagsConflictResolverDialog.StatisticsInfoTable} class.
38 */
39 @Test
40 void testStatisticsInfoTable() {
41 StatisticsInfo info = new StatisticsInfo();
42 StatisticsTableModel model = new StatisticsTableModel();
43 assertFalse(model.isCellEditable(0, 0));
44 assertEquals(1, model.getRowCount());
45 model.append(info);
46 assertEquals(2, model.getRowCount());
47 assertEquals("Paste ...", model.getValueAt(0, 0));
48 assertEquals(info, model.getValueAt(1, 0));
49 assertNull(model.getValueAt(2, 0));
50 model.reset();
51 assertEquals(1, model.getRowCount());
52 assertEquals(new Insets(0, 0, 20, 0), new StatisticsInfoTable(model).getInsets());
53 }
54}
Note: See TracBrowser for help on using the repository browser.