Changeset 15432 in josm for trunk/test/unit/org
- Timestamp:
- 2019-10-06T15:22:40+02:00 (5 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java
r15431 r15432 66 66 /** 67 67 * Tests simplification 68 * @throws IOException 69 * @throws IllegalDataException 68 * @throws Exception in case of error 70 69 */ 71 70 @Test 72 public void testSimplify() throws IllegalDataException, IOException {71 public void testSimplify() throws Exception { 73 72 DataSet DsSimplify = getDs("tracks"); 74 73 DataSet DsExpected = getDs("tracks-simplify15"); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java
r15431 r15432 83 83 } 84 84 85 private class genericNode { 86 public genericNode(Node n) { 85 private static class GenericNode { 86 final LatLon coor; 87 final Map<String, String> tags; 88 89 GenericNode(Node n) { 87 90 coor = n.getCoor().getRoundedToOsmPrecision(); 88 91 tags = n.getKeys(); 89 92 } 90 public LatLon coor; 91 public Map<String, String> tags; 93 92 94 @Override 93 95 public boolean equals(Object obj) { 94 if (!(obj instanceof genericNode)) {96 if (!(obj instanceof GenericNode)) { 95 97 return false; 96 98 } 97 genericNode other = (genericNode) obj;99 GenericNode other = (GenericNode) obj; 98 100 return coor.equals(other.coor) && tags.equals(other.tags); 99 101 } 102 100 103 @Override 101 104 public int hashCode() { … … 106 109 private void testFromTrack(String expected) throws IOException, SAXException, IllegalDataException { 107 110 final GpxData data = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks.gpx"); 108 final DataSet osmExpected = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "tracks/" + expected + ".osm")), null); 111 final DataSet osmExpected = OsmReader.parseDataSet(Files.newInputStream( 112 Paths.get(TestUtils.getTestDataRoot(), "tracks/" + expected + ".osm")), null); 109 113 final GpxLayer layer = new GpxLayer(data); 110 114 final DataSet osm = new ConvertFromGpxLayerAction(layer).convert(); 111 115 //compare sorted coordinates/tags and total amount of primitives, because IDs and order will vary after reload 112 116 113 List< genericNode> nodes = osm.getNodes().stream()114 .map( genericNode::new)117 List<GenericNode> nodes = osm.getNodes().stream() 118 .map(GenericNode::new) 115 119 .sorted(Comparator.comparing(g -> g.coor.hashCode())) 116 120 .collect(Collectors.toList()); 117 121 118 List< genericNode> nodesExpected = osmExpected.getNodes().stream()119 .map( genericNode::new)122 List<GenericNode> nodesExpected = osmExpected.getNodes().stream() 123 .map(GenericNode::new) 120 124 .sorted(Comparator.comparing(g -> g.coor.hashCode())) 121 125 .collect(Collectors.toList());
Note:
See TracChangeset
for help on using the changeset viewer.