source: josm/trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java@ 6471

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

Sonar - remove warnings related to the static preferences initialization in instance methods

File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.validation.tests;
3
4import static org.junit.Assert.assertEquals;
5
6import org.junit.BeforeClass;
7import org.junit.Test;
8import org.openstreetmap.josm.Main;
9import org.openstreetmap.josm.data.Preferences;
10import org.openstreetmap.josm.data.coor.LatLon;
11import org.openstreetmap.josm.data.osm.DataSet;
12import org.openstreetmap.josm.data.osm.Node;
13import org.openstreetmap.josm.data.projection.Projections;
14import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
15
16/**
17 * JUnit Test of "Duplicate node" validation test.
18 */
19public class DuplicateNodeTest {
20
21 /**
22 * Setup test by initializing JOSM preferences and projection.
23 */
24 @BeforeClass
25 public static void setUp() {
26 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
27 Main.initApplicationPreferences();
28 }
29
30 /**
31 * Test of "Duplicate node" validation test.
32 */
33 @Test
34 public void test() {
35 DataSet ds = new DataSet();
36
37 Node a = new Node(new LatLon(10.0, 5.0));
38 Node b = new Node(new LatLon(10.0, 5.0));
39 ds.addPrimitive(a);
40 ds.addPrimitive(b);
41
42 DuplicateNode test = new DuplicateNode();
43 test.startTest(NullProgressMonitor.INSTANCE);
44 test.visit(ds.allPrimitives());
45 test.endTest();
46
47 assertEquals(1, test.getErrors().size());
48 }
49}
Note: See TracBrowser for help on using the repository browser.