Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,6 @@ public MapboxDirections build() {
+ " the number of waypoints provided.");
}
final String waypointNamesStr = TextUtils.formatWaypointNames(waypointNames);
if (!waypointNamesStr.isEmpty() && waypointNamesStr.length() > 500) {
throw new ServicesException("Waypoint names exceed 500 character limit.");
}
waypointNames(waypointNamesStr);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,37 +680,6 @@ public void build_exceptionThrownWhenWaypointNamesDoNotMatchCoordinates() throws
.build();
}

@Test
public void build_exceptionThrownWhenWaypointNamesExceedLimit() throws Exception {
thrown.expect(ServicesException.class);
thrown.expectMessage(
startsWith("Waypoint names exceed 500 character limit"));

StringBuilder longWpName = new StringBuilder();
for (int i = 0; i < 124; i++) {
longWpName.append("Home");
}
MapboxDirections mapboxDirections = MapboxDirections.builder()
.origin(Point.fromLngLat(2.0, 2.0))
.destination(Point.fromLngLat(4.0, 4.0))
.addWaypointNames(longWpName.toString(), "Work")
.baseUrl("https://foobar.com")
.accessToken(ACCESS_TOKEN)
.build();

assertTrue(mapboxDirections.cloneCall().request().url().toString()
.contains("waypoint_names=Home"));

// one more char results in exception
mapboxDirections = MapboxDirections.builder()
.origin(Point.fromLngLat(2.0, 2.0))
.destination(Point.fromLngLat(4.0, 4.0))
.addWaypointNames(longWpName.toString(), "Work1")
.baseUrl("https://foobar.com")
.accessToken(ACCESS_TOKEN)
.build();
}

@Test
public void testWithWaypointNames() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,6 @@ public MapboxMapMatching build() {
+ " the number of waypoints provided.");
}
final String waypointNamesStr = TextUtils.formatWaypointNames(waypointNames);
if (!waypointNamesStr.isEmpty() && waypointNamesStr.length() > 500) {
throw new ServicesException("Waypoint names exceed 500 character limit.");
}
waypointNames(waypointNamesStr);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,39 +650,6 @@ public void build_exceptionThrownWhenWaypointNamesDoNotMatchWaypoints() throws E
.build();
}

@Test
public void build_exceptionThrownWhenWaypointNamesExceedLimit() throws Exception {
thrown.expect(ServicesException.class);
thrown.expectMessage(
startsWith("Waypoint names exceed 500 character limit"));

StringBuilder longWpName = new StringBuilder();
for (int i = 0; i < 124; i++) {
longWpName.append("Home");
}
MapboxMapMatching mapMatching = MapboxMapMatching.builder()
.baseUrl("https://foobar.com")
.accessToken(ACCESS_TOKEN)
.coordinate(Point.fromLngLat(2.0, 2.0))
.coordinate(Point.fromLngLat(4.0, 4.0))
.waypoints(0, 1)
.addWaypointNames(longWpName.toString(), "Work")
.build();

assertTrue(mapMatching.cloneCall().request().url().toString()
.contains("waypoint_names=Home"));

// one more char results in exception
mapMatching = MapboxMapMatching.builder()
.baseUrl("https://foobar.com")
.accessToken(ACCESS_TOKEN)
.coordinate(Point.fromLngLat(2.0, 2.0))
.coordinate(Point.fromLngLat(4.0, 4.0))
.waypoints(0, 1)
.addWaypointNames(longWpName.toString(), "Work1") // waypoint ar too long
.build();
}

@Test
public void testWithWaypointNames() throws Exception {

Expand Down