source: josm/trunk/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java@ 9130

Last change on this file since 9130 was 8993, checked in by Don-vip, 8 years ago

fix #12060 - NPE

File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import static org.junit.Assert.assertFalse;
5import static org.junit.Assert.assertNotNull;
6import static org.junit.Assert.assertNull;
7
8import org.junit.BeforeClass;
9import org.junit.Test;
10import org.openstreetmap.josm.JOSMFixture;
11import org.openstreetmap.josm.data.Bounds;
12import org.openstreetmap.josm.data.DataSource;
13import org.openstreetmap.josm.data.coor.LatLon;
14
15/**
16 * Unit tests of the {@code Node} class.
17 */
18public class NodeTest {
19
20 /**
21 * Setup test.
22 */
23 @BeforeClass
24 public static void setUpBeforeClass() {
25 JOSMFixture.createUnitTestFixture().init();
26 }
27
28 /**
29 * Non-regression test for ticket #12060.
30 */
31 @Test
32 public void testTicket12060() {
33 DataSet ds = new DataSet();
34 ds.dataSources.add(new DataSource(new Bounds(LatLon.ZERO), null));
35 Node n = new Node(1, 1);
36 n.setCoor(LatLon.ZERO);
37 ds.addPrimitive(n);
38 n.setCoor(null);
39 assertFalse(n.isNewOrUndeleted());
40 assertNotNull(ds.getDataSourceArea());
41 assertNull(n.getCoor());
42 assertFalse(n.isOutsideDownloadArea());
43 }
44}
Note: See TracBrowser for help on using the repository browser.