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