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

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

ConflictDialog: fix findbugs issue, add unit test

File size: 1.9 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertNotNull;
6
7import java.awt.Color;
8import java.awt.image.BufferedImage;
9
10import org.junit.BeforeClass;
11import org.junit.Test;
12import org.openstreetmap.josm.JOSMFixture;
13import org.openstreetmap.josm.Main;
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.dialogs.ConflictDialog.ConflictPainter;
19
20/**
21 * Unit tests of {@link ConflictDialog} class.
22 */
23public class ConflictDialogTest {
24
25 /**
26 * Setup tests
27 */
28 @BeforeClass
29 public static void setUpBeforeClass() {
30 JOSMFixture.createUnitTestFixture().init(true);
31 }
32
33 /**
34 * Unit test of {@link ConflictDialog#ConflictDialog}.
35 */
36 @Test
37 public void testConflictDialog() {
38 assertNotNull(new ConflictDialog());
39 }
40
41 /**
42 * Unit test of {@link ConflictDialog#getColor} method.
43 */
44 @Test
45 public void testGetColor() {
46 assertEquals(Color.gray, ConflictDialog.getColor());
47 }
48
49 /**
50 * Unit tests of {@link ConflictPainter} class.
51 */
52 @Test
53 public void testConflictPainter() {
54 ConflictPainter cp = new ConflictPainter(Main.map.mapView, new BufferedImage(800, 600, BufferedImage.TYPE_3BYTE_BGR).createGraphics());
55 Node n1 = new Node(1, 1);
56 Node n2 = new Node(2, 1);
57 Way w = new Way(1, 1);
58 w.addNode(n1);
59 w.addNode(n2);
60 Relation r = new Relation(1, 1);
61 r.addMember(new RelationMember("outer", w));
62 cp.visit(n1);
63 cp.visit(n2);
64 cp.visit(w);
65 cp.visit(r);
66 }
67}
Note: See TracBrowser for help on using the repository browser.