Add expected segments verification.

This commit is contained in:
y.ridkous@gmail.com 2016-03-17 20:10:48 +02:00
parent cdcfb2d5ba
commit 4e51707fad

View file

@ -3,7 +3,6 @@ package net.osmand.router;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.router.TestEntry;
import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -89,6 +88,7 @@ public class RouteResultPreparationTest {
public void testLanes() throws Exception { public void testLanes() throws Exception {
List<RouteSegmentResult> routeSegments = fe.searchRoute(ctx, startPoint, endPoint, null); List<RouteSegmentResult> routeSegments = fe.searchRoute(ctx, startPoint, endPoint, null);
Set<Long> reachedSegments = new TreeSet<Long>();
int prevSegment = -1; int prevSegment = -1;
for (int i = 0; i <= routeSegments.size(); i++) { for (int i = 0; i <= routeSegments.size(); i++) {
@ -110,6 +110,15 @@ public class RouteResultPreparationTest {
} }
prevSegment = i; prevSegment = i;
} }
if (i < routeSegments.size()) {
reachedSegments.add(routeSegments.get(i).getObject().getId());
}
}
Set<Long> expectedSegments = expectedResults.keySet();
for (Long expSegId : expectedSegments){
Assert.assertTrue("Expected segment " + expSegId + " weren't reached in route segments " + reachedSegments.toString(), reachedSegments.contains(expSegId));
} }
} }