1 | package org.openstreetmap.josm.data.osm;
|
---|
2 |
|
---|
3 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
4 | import org.openstreetmap.josm.testframework.MotherObject;
|
---|
5 |
|
---|
6 | public class NodeTest extends MotherObject {
|
---|
7 |
|
---|
8 | private Node node;
|
---|
9 |
|
---|
10 | @Override protected void setUp() throws Exception {
|
---|
11 | super.setUp();
|
---|
12 | node = createNode();
|
---|
13 | }
|
---|
14 |
|
---|
15 | public void testVisit() {
|
---|
16 | OsmPrimitiveTest.TestCalledVisitor v = new OsmPrimitiveTest.TestCalledVisitor();
|
---|
17 | node.visit(v);
|
---|
18 | assertEquals("Node", v.called);
|
---|
19 | }
|
---|
20 |
|
---|
21 | public void testCloneFromRealEqual() {
|
---|
22 | Node node2 = createNode(23,3,4);
|
---|
23 | assertFalse(node2.realEqual(node, false));
|
---|
24 | assertFalse(node.realEqual(node2, false));
|
---|
25 | node.cloneFrom(node2);
|
---|
26 | assertTrue(node2.realEqual(node, false));
|
---|
27 | assertTrue(node.realEqual(node2, false));
|
---|
28 | }
|
---|
29 |
|
---|
30 | public void testNodeNode() {
|
---|
31 | Node node2 = new Node(node);
|
---|
32 | assertTrue(node2.realEqual(node, false));
|
---|
33 | }
|
---|
34 |
|
---|
35 | public void testNodeLatLon() {
|
---|
36 | LatLon latLon = new LatLon(1,2);
|
---|
37 | node = new Node(latLon);
|
---|
38 | assertEquals(node.coor, latLon);
|
---|
39 | }
|
---|
40 |
|
---|
41 | public void testCompareToNodeTypeBiggestOrComparedAfterId() {
|
---|
42 | assertEquals(1, node.compareTo(createSegment()));
|
---|
43 | assertEquals(1, node.compareTo(createWay()));
|
---|
44 | Node node2 = createNode(23,1,2);
|
---|
45 | assertEquals(-1, node.compareTo(node2));
|
---|
46 | assertEquals(1, node2.compareTo(node));
|
---|
47 | }
|
---|
48 | }
|
---|