source: josm/trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialogTest.java@ 17536

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

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

  • Property svn:eol-style set to native
File size: 2.4 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.junit.jupiter.api.extension.RegisterExtension;
12import org.junit.jupiter.api.Test;
13import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
14import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfo;
15import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfoTable;
16import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsTableModel;
17import org.openstreetmap.josm.testutils.JOSMTestRules;
18
19import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
20
21/**
22 * Unit tests of {@link PasteTagsConflictResolverDialog} class.
23 */
24class PasteTagsConflictResolverDialogTest {
25
26 /**
27 * Setup test.
28 */
29 @RegisterExtension
30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
31 public JOSMTestRules test = new JOSMTestRules();
32
33 /**
34 * Unit test of {@link PasteTagsConflictResolverDialog#PANE_TITLES}.
35 */
36 @Test
37 void testPaneTitles() {
38 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES);
39 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.NODE));
40 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.WAY));
41 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.RELATION));
42 }
43
44 /**
45 * Unit test of {@link PasteTagsConflictResolverDialog.StatisticsInfoTable} class.
46 */
47 @Test
48 void testStatisticsInfoTable() {
49 StatisticsInfo info = new StatisticsInfo();
50 StatisticsTableModel model = new StatisticsTableModel();
51 assertFalse(model.isCellEditable(0, 0));
52 assertEquals(1, model.getRowCount());
53 model.append(info);
54 assertEquals(2, model.getRowCount());
55 assertEquals("Paste ...", model.getValueAt(0, 0));
56 assertEquals(info, model.getValueAt(1, 0));
57 assertNull(model.getValueAt(2, 0));
58 model.reset();
59 assertEquals(1, model.getRowCount());
60 assertEquals(new Insets(0, 0, 20, 0), new StatisticsInfoTable(model).getInsets());
61 }
62}
Note: See TracBrowser for help on using the repository browser.