Changeset 1910 in josm for trunk/test/unit/org/openstreetmap/josm/data/osm
- Timestamp:
- 2009-08-05T08:19:02+02:00 (15 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data/osm/visitor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r1890 r1910 2 2 package org.openstreetmap.josm.data.osm.visitor; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNotNull; 6 import static org.junit.Assert.assertNull; 7 import static org.junit.Assert.assertTrue; 8 4 9 import java.util.Collection; 5 10 6 import org.junit.Ignore;7 11 import org.junit.Test; 8 12 import org.openstreetmap.josm.data.coor.LatLon; … … 13 17 import org.openstreetmap.josm.data.osm.RelationMember; 14 18 import org.openstreetmap.josm.data.osm.Way; 15 16 import static org.junit.Assert.*;17 19 18 20 public class MergeSourceBuildingVisitorTest { … … 69 71 Node n2 = new Node(2); 70 72 Way w1 = new Way(3); 71 w1. nodes.add(n1);72 w1. nodes.add(n2);73 w1.addNode(n1); 74 w1.addNode(n2); 73 75 source.nodes.add(n1); 74 76 source.nodes.add(n2); … … 101 103 Node n2 = new Node(2); 102 104 Way w1 = new Way(3); 103 w1. nodes.add(n1);104 w1. nodes.add(n2);105 w1.addNode(n1); 106 w1.addNode(n2); 105 107 source.nodes.add(n1); 106 108 source.nodes.add(n2); … … 154 156 Way w30 = new Way(30); 155 157 Node n21; 156 w30. nodes.add(n21 = new Node(21));158 w30.addNode(n21 = new Node(21)); 157 159 Node n22; 158 w30. nodes.add(n22 = new Node(22));160 w30.addNode(n22 = new Node(22)); 159 161 r1.members.add(new RelationMember("way-30",w30)); 160 162 Relation r40 = new Relation(40); … … 181 183 Way w = (Way)hull.getPrimitiveById(30); 182 184 assertNotNull(w); 183 assertEquals(2, w. nodes.size());185 assertEquals(2, w.getNodesCount()); 184 186 Node n = (Node)hull.getPrimitiveById(21); 185 187 assertNotNull(n); 186 assertTrue(w. nodes.contains(n));188 assertTrue(w.getNodes().contains(n)); 187 189 188 190 n = (Node)hull.getPrimitiveById(22); 189 191 assertNotNull(n); 190 assertTrue(w. nodes.contains(n));192 assertTrue(w.getNodes().contains(n)); 191 193 192 194 Relation r = (Relation)hull.getPrimitiveById(40); … … 212 214 Way w30 = new Way(30); 213 215 Node n21; 214 w30. nodes.add(n21 = new Node(21));216 w30.addNode(n21 = new Node(21)); 215 217 Node n22; 216 w30. nodes.add(n22 = new Node(22));218 w30.addNode(n22 = new Node(22)); 217 219 r1.members.add(new RelationMember("way-30",w30)); 218 220 Relation r40 = new Relation(40); … … 274 276 w30.put("name", "w30"); 275 277 Node n21; 276 w30. nodes.add(n21 = new Node(new LatLon(21.0,21.0)));278 w30.addNode(n21 = new Node(new LatLon(21.0,21.0))); 277 279 n21.put("name","n21"); 278 280 Node n22; 279 w30. nodes.add(n22 = new Node(new LatLon(22.0,22.0)));281 w30.addNode(n22 = new Node(new LatLon(22.0,22.0))); 280 282 n22.put("name","n22"); 281 283 r1.members.add(new RelationMember("way-30",w30)); … … 304 306 Way w = (Way)lookupByName(hull.ways, "w30"); 305 307 assertNotNull(w); 306 assertEquals(2, w. nodes.size());308 assertEquals(2, w.getNodesCount()); 307 309 308 310 Node n = (Node)lookupByName(hull.nodes, "n21"); 309 311 assertNotNull(n); 310 assertTrue(w. nodes.contains(n));312 assertTrue(w.getNodes().contains(n)); 311 313 312 314 n = (Node)lookupByName(hull.nodes, "n22"); 313 315 assertNotNull(n); 314 assertTrue(w. nodes.contains(n));316 assertTrue(w.getNodes().contains(n)); 315 317 316 318 Relation r = (Relation)lookupByName(hull.relations, "r40"); -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java
r1813 r1910 489 489 myWay.version = 1; 490 490 myWay.put("key1", "value1"); 491 myWay. nodes.add(n1);492 myWay. nodes.add(n2);491 myWay.addNode(n1); 492 myWay.addNode(n2); 493 493 my.addPrimitive(myWay); 494 494 … … 511 511 theirWay.put("key1", "value1"); 512 512 theirWay.put("key2", "value2"); 513 theirWay. nodes.add(n3);514 theirWay. nodes.add(n4);513 theirWay.addNode(n3); 514 theirWay.addNode(n4); 515 515 their.addPrimitive(theirWay); 516 516 … … 525 525 assertEquals(3,merged.id); 526 526 assertEquals(2,merged.version); 527 assertEquals(2,merged. nodes.size());528 assertEquals(1,merged. nodes.get(0).id);529 assertEquals(2,merged. nodes.get(1).id);527 assertEquals(2,merged.getNodesCount()); 528 assertEquals(1,merged.getNode(0).id); 529 assertEquals(2,merged.getNode(1).id); 530 530 531 531 } … … 557 557 myWay.id = 3; 558 558 myWay.version = 1; 559 myWay. nodes.add(n1);560 myWay. nodes.add(n2);559 myWay.addNode(n1); 560 myWay.addNode(n2); 561 561 my.addPrimitive(myWay); 562 562 … … 586 586 theirWay.id = 3; 587 587 theirWay.version = 2; 588 theirWay. nodes.add(n3);589 theirWay. nodes.add(n5); // insert a node590 theirWay. nodes.add(n4); // this one is updated588 theirWay.addNode(n3); 589 theirWay.addNode(n5); // insert a node 590 theirWay.addNode(n4); // this one is updated 591 591 their.addPrimitive(theirWay); 592 592 … … 599 599 assertEquals(3,merged.id); 600 600 assertEquals(2,merged.version); 601 assertEquals(3,merged. nodes.size());602 assertEquals(1,merged. nodes.get(0).id);603 assertEquals(4,merged. nodes.get(1).id);604 assertEquals(2,merged. nodes.get(2).id);605 assertEquals("value1",merged. nodes.get(2).get("key1"));601 assertEquals(3,merged.getNodesCount()); 602 assertEquals(1,merged.getNode(0).id); 603 assertEquals(4,merged.getNode(1).id); 604 assertEquals(2,merged.getNode(2).id); 605 assertEquals("value1",merged.getNode(2).get("key1")); 606 606 } 607 607 … … 631 631 myWay.id = 3; 632 632 myWay.version = 1; 633 myWay. nodes.add(n1);634 myWay. nodes.add(n2);633 myWay.addNode(n1); 634 myWay.addNode(n2); 635 635 myWay.modified = true; 636 636 myWay.put("key1", "value1"); … … 662 662 theirWay.id = 3; 663 663 theirWay.version = 2; 664 theirWay. nodes.add(n3);665 theirWay. nodes.add(n5); // insert a node666 theirWay. nodes.add(n4); // this one is updated664 theirWay.addNode(n3); 665 theirWay.addNode(n5); // insert a node 666 theirWay.addNode(n4); // this one is updated 667 667 their.addPrimitive(theirWay); 668 668 … … 675 675 assertEquals(3,merged.id); 676 676 assertEquals(1,merged.version); 677 assertEquals(2,merged. nodes.size());678 assertEquals(1,merged. nodes.get(0).id);679 assertEquals(2,merged. nodes.get(1).id);677 assertEquals(2,merged.getNodesCount()); 678 assertEquals(1,merged.getNode(0).id); 679 assertEquals(2,merged.getNode(1).id); 680 680 assertEquals("value1",merged.get("key1")); 681 681 } … … 707 707 myWay.id = 3; 708 708 myWay.version = 1; 709 myWay. nodes.add(n1);710 myWay. nodes.add(n2);709 myWay.addNode(n1); 710 myWay.addNode(n2); 711 711 my.addPrimitive(myWay); 712 712 … … 757 757 myWay.id = 0; 758 758 myWay.version = -1; 759 myWay. nodes.add(n1);760 myWay. nodes.add(n2);759 myWay.addNode(n1); 760 myWay.addNode(n2); 761 761 my.addPrimitive(myWay); 762 762 … … 777 777 theirWay.id = 0; 778 778 theirWay.version = -1; 779 theirWay. nodes.add(n3);780 theirWay. nodes.add(n4);779 theirWay.addNode(n3); 780 theirWay.addNode(n4); 781 781 theirWay.user = User.get("their"); 782 782 theirWay.user.uid = "1111"; … … 819 819 myWay.id = 0; 820 820 myWay.version = -1; 821 myWay. nodes.add(n1);822 myWay. nodes.add(n2);821 myWay.addNode(n1); 822 myWay.addNode(n2); 823 823 my.addPrimitive(myWay); 824 824 … … 839 839 theirWay.id = 0; 840 840 theirWay.version = -1; 841 theirWay. nodes.add(n3);842 theirWay. nodes.add(n4);841 theirWay.addNode(n3); 842 theirWay.addNode(n4); 843 843 theirWay.user = User.get("their"); 844 844 theirWay.user.uid = "1111"; … … 899 899 theirWay.id = 4; 900 900 theirWay.version = 1; 901 theirWay. nodes.add(n3);902 theirWay. nodes.add(n4);903 theirWay. nodes.add(n5);901 theirWay.addNode(n3); 902 theirWay.addNode(n4); 903 theirWay.addNode(n5); 904 904 theirWay.user = User.get("their"); 905 905 theirWay.user.uid = "1111"; … … 913 913 914 914 Way myWay = (Way)my.getPrimitiveById(4); 915 assertEquals(2, myWay. nodes.size());915 assertEquals(2, myWay.getNodesCount()); 916 916 917 917 Node n = (Node)my.getPrimitiveById(1);
Note:
See TracChangeset
for help on using the changeset viewer.