Skip to content

Commit 6f39c2c

Browse files
Restructure tests
1 parent 6e460f4 commit 6f39c2c

File tree

10 files changed

+46
-37
lines changed

10 files changed

+46
-37
lines changed

application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.opentripplanner.graph_builder.module.StreetLinkerModule;
1919
import org.opentripplanner.routing.api.request.StreetMode;
2020
import org.opentripplanner.routing.graph.Graph;
21-
import org.opentripplanner.routing.linking.Scope;
2221
import org.opentripplanner.routing.linking.VertexLinker;
2322
import org.opentripplanner.street.model.StreetTraversalPermission;
2423
import org.opentripplanner.street.model.edge.AreaEdge;

application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/Subgraph.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Iterator<TransitStopVertex> stopIterator() {
8888
// For speed reasons, graph geometry only within given search radius is considered.
8989
// Distance is estimated using minimal vertex to vertex search instead of computing
9090
// distances between graph edges. This is good enough for our heuristics.
91-
double distanceFromOtherGraph(Graph index, double searchRadius) {
91+
double distanceFromOtherGraph(Graph graph, double searchRadius) {
9292
Vertex v = getRepresentativeVertex();
9393
double xscale = Math.cos((v.getCoordinate().y * Math.PI) / 180);
9494
double searchRadiusDegrees = SphericalDistanceLibrary.metersToDegrees(searchRadius);
@@ -104,7 +104,7 @@ Iterator<TransitStopVertex> stopIterator() {
104104
}
105105
envelope.expandBy(searchRadiusDegrees / xscale, searchRadiusDegrees);
106106

107-
return index
107+
return graph
108108
.findVertices(envelope)
109109
.stream()
110110
.filter(vx -> !contains(vx))

application/src/main/java/org/opentripplanner/graph_builder/module/osm/WalkableAreaBuilder.java

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.opentripplanner.routing.api.request.StreetMode;
3333
import org.opentripplanner.routing.api.request.request.StreetRequest;
3434
import org.opentripplanner.routing.graph.Graph;
35-
import org.opentripplanner.routing.linking.Scope;
3635
import org.opentripplanner.service.osminfo.OsmInfoGraphBuildRepository;
3736
import org.opentripplanner.service.osminfo.model.Platform;
3837
import org.opentripplanner.street.model.StreetTraversalPermission;

application/src/test/java/org/opentripplanner/astar/AStarTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
import org.opentripplanner.routing.algorithm.MultiTargetTerminationStrategy;
1919
import org.opentripplanner.routing.api.request.RouteRequest;
2020
import org.opentripplanner.routing.graph.Graph;
21-
import org.opentripplanner.routing.graph.SimpleConcreteEdge;
22-
import org.opentripplanner.routing.graph.TemporaryConcreteEdge;
21+
import org.opentripplanner.street.model._data.SimpleConcreteEdge;
2322
import org.opentripplanner.street.model._data.StreetModelForTest;
23+
import org.opentripplanner.street.model._data.TemporaryConcreteEdge;
2424
import org.opentripplanner.street.model.edge.Edge;
2525
import org.opentripplanner.street.model.vertex.TemporaryStreetLocation;
2626
import org.opentripplanner.street.model.vertex.Vertex;

application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java application/src/test/java/org/opentripplanner/routing/api/DefaultRoutingServiceTest.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.opentripplanner.routing.graph;
1+
package org.opentripplanner.routing.api;
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
44
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -25,8 +25,6 @@
2525
/**
2626
* Check that the graph index is created, that GTFS elements can be found in the index, and that the
2727
* indexes are coherent with one another.
28-
* <p>
29-
* TODO: The old transit index doesn't exist anymore, and the new one needs more tests.
3028
*/
3129
public class DefaultRoutingServiceTest extends GtfsTest {
3230

@@ -121,14 +119,4 @@ public void testSpatialIndex() {
121119
assertTrue(stops.contains(stopM));
122120
assertTrue(stops.size() >= 3); // Query can overselect
123121
}
124-
125-
@Test
126-
public void testParentStations() {
127-
// graph.index.stopsForParentStation;
128-
}
129-
130-
@Test
131-
public void testLucene() {
132-
// graph.index.luceneIndex
133-
}
134122
}

application/src/test/java/org/opentripplanner/routing/core/GraphTest.java application/src/test/java/org/opentripplanner/routing/graph/GraphTest.java

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.opentripplanner.routing.core;
1+
package org.opentripplanner.routing.graph;
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
44
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -11,7 +11,6 @@
1111
import org.locationtech.jts.geom.Coordinate;
1212
import org.locationtech.jts.geom.LineString;
1313
import org.opentripplanner.framework.geometry.GeometryUtils;
14-
import org.opentripplanner.routing.graph.Graph;
1514
import org.opentripplanner.street.model.StreetTraversalPermission;
1615
import org.opentripplanner.street.model._data.StreetModelForTest;
1716
import org.opentripplanner.street.model.edge.Edge;
@@ -22,22 +21,22 @@
2221
import org.opentripplanner.street.model.vertex.Vertex;
2322
import org.opentripplanner.street.model.vertex.VertexLabel;
2423

25-
public class GraphTest {
24+
class GraphTest {
2625

2726
@Test
28-
public void testBasic() {
27+
void testBasic() {
2928
Graph g = new Graph();
3029
assertNotNull(g);
3130
}
3231

3332
@Test
34-
public void testAddVertex() {
33+
void testAddVertex() {
3534
Vertex a = StreetModelForTest.intersectionVertex("A", 5, 5);
3635
assertEquals(a.getLabel(), VertexLabel.string("A"));
3736
}
3837

3938
@Test
40-
public void testGetVertex() {
39+
void testGetVertex() {
4140
var g = new Graph();
4241
Vertex a = StreetModelForTest.intersectionVertex("A", 5, 5);
4342
g.addVertex(a);
@@ -46,15 +45,15 @@ public void testGetVertex() {
4645
}
4746

4847
@Test
49-
public void testAddEdge() {
48+
void testAddEdge() {
5049
Vertex a = StreetModelForTest.intersectionVertex("A", 5, 5);
5150
Vertex b = StreetModelForTest.intersectionVertex("B", 6, 6);
5251
FreeEdge ee = FreeEdge.createFreeEdge(a, b);
5352
assertNotNull(ee);
5453
}
5554

5655
@Test
57-
public void testGetEdgesOneEdge() {
56+
void testGetEdgesOneEdge() {
5857
Graph g = new Graph();
5958
Vertex a = StreetModelForTest.intersectionVertex("A", 5, 5);
6059
Vertex b = StreetModelForTest.intersectionVertex("B", 6, 6);
@@ -70,7 +69,7 @@ public void testGetEdgesOneEdge() {
7069
}
7170

7271
@Test
73-
public void testGetEdgesMultiple() {
72+
void testGetEdgesMultiple() {
7473
Graph g = new Graph();
7574
Vertex a = StreetModelForTest.intersectionVertex("A", 5, 5);
7675
Vertex b = StreetModelForTest.intersectionVertex("B", 6, 6);
@@ -92,7 +91,7 @@ public void testGetEdgesMultiple() {
9291
}
9392

9493
@Test
95-
public void testGetStreetEdgesNone() {
94+
void testGetStreetEdgesNone() {
9695
Graph g = new Graph();
9796
Vertex a = StreetModelForTest.intersectionVertex("A", 5, 5);
9897
Vertex b = StreetModelForTest.intersectionVertex("B", 6, 6);
@@ -109,7 +108,7 @@ public void testGetStreetEdgesNone() {
109108
}
110109

111110
@Test
112-
public void testGetStreetEdgesSeveral() {
111+
void testGetStreetEdgesSeveral() {
113112
Graph g = new Graph();
114113
StreetVertex a = StreetModelForTest.intersectionVertex("A", 5, 5);
115114
StreetVertex b = StreetModelForTest.intersectionVertex("B", 6, 6);
@@ -131,7 +130,7 @@ public void testGetStreetEdgesSeveral() {
131130
}
132131

133132
@Test
134-
public void testGetEdgesAndVerticesById() {
133+
void testGetEdgesAndVerticesById() {
135134
StreetVertex a = StreetModelForTest.intersectionVertex("A", 5, 5);
136135
StreetVertex b = StreetModelForTest.intersectionVertex("B", 6, 6);
137136
StreetVertex c = StreetModelForTest.intersectionVertex("C", 3, 2);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.opentripplanner.routing.linking;
2+
3+
import static org.junit.jupiter.api.Assertions.*;
4+
5+
import org.junit.jupiter.api.Test;
6+
import org.opentripplanner.routing.graph.Graph;
7+
import org.opentripplanner.street.model._data.StreetModelForTest;
8+
import org.opentripplanner.test.support.GeoJsonIo;
9+
10+
class VertexLinkerTest {
11+
12+
@Test
13+
void flex() {
14+
var v1 = StreetModelForTest.intersectionVertex(0, 0);
15+
var v2 = StreetModelForTest.intersectionVertex(0.1, 0.1);
16+
var edge = StreetModelForTest.streetEdge(v1, v2);
17+
18+
var graph = new Graph();
19+
20+
graph.addVertex(v1);
21+
graph.addVertex(v2);
22+
graph.index();
23+
24+
System.out.println(GeoJsonIo.toUrl(graph));
25+
}
26+
}

application/src/test/java/org/opentripplanner/routing/graph/SimpleConcreteEdge.java application/src/test/java/org/opentripplanner/street/model/_data/SimpleConcreteEdge.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
package org.opentripplanner.routing.graph;
1+
package org.opentripplanner.street.model._data;
22

3-
import org.locationtech.jts.geom.LineString;
43
import org.opentripplanner.framework.geometry.SphericalDistanceLibrary;
54
import org.opentripplanner.framework.i18n.I18NString;
65
import org.opentripplanner.street.model.edge.Edge;

application/src/test/java/org/opentripplanner/routing/graph/TemporaryConcreteEdge.java application/src/test/java/org/opentripplanner/street/model/_data/TemporaryConcreteEdge.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.opentripplanner.routing.graph;
1+
package org.opentripplanner.street.model._data;
22

33
import org.opentripplanner.framework.geometry.SphericalDistanceLibrary;
44
import org.opentripplanner.framework.i18n.I18NString;

application/src/test/java/org/opentripplanner/routing/graph/EdgeTest.java application/src/test/java/org/opentripplanner/street/model/edge/EdgeTest.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
package org.opentripplanner.routing.graph;
1+
package org.opentripplanner.street.model.edge;
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
44
import static org.opentripplanner.street.model._data.StreetModelForTest.intersectionVertex;
55

66
import org.junit.jupiter.api.Test;
77
import org.opentripplanner.street.model.StreetTraversalPermission;
8+
import org.opentripplanner.street.model._data.SimpleConcreteEdge;
89
import org.opentripplanner.street.model._data.StreetModelForTest;
9-
import org.opentripplanner.street.model.edge.Edge;
10-
import org.opentripplanner.street.model.edge.StreetEdgeBuilder;
1110
import org.opentripplanner.street.model.vertex.StreetVertex;
1211
import org.opentripplanner.street.model.vertex.Vertex;
1312

0 commit comments

Comments
 (0)