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

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

javadoc/code style/minor refactorization

File size: 1.4 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.coor.LatLon;
10import org.openstreetmap.josm.data.osm.DataSet;
11import org.openstreetmap.josm.data.osm.Node;
12import org.openstreetmap.josm.data.projection.Projections;
13import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
14
15/**
16 * JUnit Test of "Duplicate node" validation test.
17 */
18public class DuplicateNodeTest {
19
20 /**
21 * Setup test by initializing JOSM preferences and projection.
22 */
23 @BeforeClass
24 public static void setUp() {
25 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
26 Main.initApplicationPreferences();
27 }
28
29 /**
30 * Test of "Duplicate node" validation test.
31 */
32 @Test
33 public void test() {
34 DataSet ds = new DataSet();
35
36 Node a = new Node(new LatLon(10.0, 5.0));
37 Node b = new Node(new LatLon(10.0, 5.0));
38 ds.addPrimitive(a);
39 ds.addPrimitive(b);
40
41 DuplicateNode test = new DuplicateNode();
42 test.startTest(NullProgressMonitor.INSTANCE);
43 test.visit(ds.allPrimitives());
44 test.endTest();
45
46 assertEquals(1, test.getErrors().size());
47 }
48}
Note: See TracBrowser for help on using the repository browser.