source: josm/trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java@ 17275

Last change on this file since 17275 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.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs;
3
4import static org.junit.jupiter.api.Assertions.assertEquals;
5import static org.junit.jupiter.api.Assertions.assertNotNull;
6
7import java.awt.Color;
8import java.awt.image.BufferedImage;
9
10import org.junit.jupiter.api.extension.RegisterExtension;
11import org.junit.jupiter.api.Test;
12import org.openstreetmap.josm.data.coor.LatLon;
13import org.openstreetmap.josm.data.osm.DataSet;
14import org.openstreetmap.josm.data.osm.Node;
15import org.openstreetmap.josm.data.osm.Relation;
16import org.openstreetmap.josm.data.osm.RelationMember;
17import org.openstreetmap.josm.data.osm.Way;
18import org.openstreetmap.josm.gui.MainApplication;
19import org.openstreetmap.josm.gui.dialogs.ConflictDialog.ConflictPainter;
20import org.openstreetmap.josm.gui.layer.OsmDataLayer;
21import org.openstreetmap.josm.testutils.JOSMTestRules;
22
23import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
24
25/**
26 * Unit tests of {@link ConflictDialog} class.
27 */
28class ConflictDialogTest {
29
30 /**
31 * Setup tests
32 */
33 @RegisterExtension
34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
35 public JOSMTestRules test = new JOSMTestRules().main().projection();
36
37 /**
38 * Unit test of {@link ConflictDialog#ConflictDialog}.
39 */
40 @Test
41 void testConflictDialog() {
42 assertNotNull(new ConflictDialog());
43 }
44
45 /**
46 * Unit test of {@link ConflictDialog#getColor} method.
47 */
48 @Test
49 void testGetColor() {
50 assertEquals(Color.gray, ConflictDialog.getColor());
51 }
52
53 /**
54 * Unit tests of {@link ConflictPainter} class.
55 */
56 @Test
57 void testConflictPainter() {
58 MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
59 ConflictPainter cp = new ConflictPainter(MainApplication.getMap().mapView,
60 new BufferedImage(800, 600, BufferedImage.TYPE_3BYTE_BGR).createGraphics());
61 Node n1 = new Node(1, 1);
62 n1.setCoor(new LatLon(1, 1));
63 Node n2 = new Node(2, 1);
64 n2.setCoor(new LatLon(2, 2));
65 Way w = new Way(1, 1);
66 w.addNode(n1);
67 w.addNode(n2);
68 Relation r = new Relation(1, 1);
69 r.addMember(new RelationMember("outer", w));
70 cp.visit(n1);
71 cp.visit(n2);
72 cp.visit(w);
73 cp.visit(r);
74 }
75}
Note: See TracBrowser for help on using the repository browser.