Changeset 15811 in josm for trunk/test/unit/org
- Timestamp:
- 2020-02-03T06:35:22+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/MultiFetchOverpassObjectReaderTest.java
r15717 r15811 5 5 6 6 import java.util.Arrays; 7 import java.util.TreeSet; 7 8 import org.junit.Rule; 9 import org.junit.Test; 10 import org.openstreetmap.josm.data.osm.Node; 11 import org.openstreetmap.josm.data.osm.Relation; 12 import org.openstreetmap.josm.data.osm.Way; 13 import org.openstreetmap.josm.testutils.JOSMTestRules; 8 14 9 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 10 import org.junit.Rule;11 import org.junit.Test;12 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;13 import org.openstreetmap.josm.testutils.JOSMTestRules;14 import org.openstreetmap.josm.tools.Utils;15 16 16 17 /** … … 30 31 */ 31 32 @Test 32 public void testBuildRequestString() { 33 String requestString = new MultiFetchOverpassObjectReader() 34 .buildRequestString(OsmPrimitiveType.WAY, new TreeSet<>(Arrays.asList(130L, 123L, 126L))); 35 assertEquals("interpreter?data=" + Utils.encodeUrl("(way(123);>;way(126);>;way(130);>;);out meta;"), requestString); 33 public void testBuildRequestWaysString() { 34 MultiFetchOverpassObjectReader reader = new MultiFetchOverpassObjectReader(); 35 reader.append(Arrays.asList(new Way(123), new Way(126), new Way(130))); 36 String requestString = reader.buildComplexRequestString(); 37 assertEquals("(way(id:123,126,130);>;);out meta;", requestString); 38 } 39 40 /** 41 * Test {@link MultiFetchOverpassObjectReader#buildRequestString} 42 */ 43 @Test 44 public void testBuildRequestRelationsString() { 45 MultiFetchOverpassObjectReader reader = new MultiFetchOverpassObjectReader(); 46 reader.append(Arrays.asList(new Relation(123), new Relation(126), new Relation(130))); 47 reader.setRecurseDownRelations(true); 48 String requestString = reader.buildComplexRequestString(); 49 assertEquals("relation(id:123,126,130);>>;out meta;", requestString); 50 reader.setRecurseDownRelations(false); 51 requestString = reader.buildComplexRequestString(); 52 assertEquals("relation(id:123,126,130);out meta;", requestString); 53 } 54 55 /** 56 * Test {@link MultiFetchOverpassObjectReader#buildRequestString} 57 */ 58 @Test 59 public void testBuildComplexString() { 60 MultiFetchOverpassObjectReader reader = new MultiFetchOverpassObjectReader(); 61 reader.setRecurseDownRelations(true); 62 reader.append(Arrays.asList(new Relation(123), new Relation(126), new Relation(130), new Way(88), new Way(99), 63 new Node(1))); 64 String requestString = reader.buildComplexRequestString(); 65 assertEquals("(relation(id:123,126,130);>>;(way(id:88,99);>;);node(1););out meta;", requestString); 66 reader.setRecurseDownRelations(false); 67 requestString = reader.buildComplexRequestString(); 68 assertEquals("(relation(id:123,126,130);(way(id:88,99);>;);node(1););out meta;", requestString); 36 69 } 37 70
Note:
See TracChangeset
for help on using the changeset viewer.