Skip to content

Commit 58b8d00

Browse files
remove character waypoint names limit from mapbox map matching and mapbox directions (#941)
1 parent 4c95c12 commit 58b8d00

4 files changed

Lines changed: 0 additions & 70 deletions

File tree

services-directions/src/main/java/com/mapbox/api/directions/v5/MapboxDirections.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,6 @@ public MapboxDirections build() {
754754
+ " the number of waypoints provided.");
755755
}
756756
final String waypointNamesStr = TextUtils.formatWaypointNames(waypointNames);
757-
if (!waypointNamesStr.isEmpty() && waypointNamesStr.length() > 500) {
758-
throw new ServicesException("Waypoint names exceed 500 character limit.");
759-
}
760757
waypointNames(waypointNamesStr);
761758
}
762759

services-directions/src/test/java/com/mapbox/api/directions/v5/MapboxDirectionsTest.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -680,37 +680,6 @@ public void build_exceptionThrownWhenWaypointNamesDoNotMatchCoordinates() throws
680680
.build();
681681
}
682682

683-
@Test
684-
public void build_exceptionThrownWhenWaypointNamesExceedLimit() throws Exception {
685-
thrown.expect(ServicesException.class);
686-
thrown.expectMessage(
687-
startsWith("Waypoint names exceed 500 character limit"));
688-
689-
StringBuilder longWpName = new StringBuilder();
690-
for (int i = 0; i < 124; i++) {
691-
longWpName.append("Home");
692-
}
693-
MapboxDirections mapboxDirections = MapboxDirections.builder()
694-
.origin(Point.fromLngLat(2.0, 2.0))
695-
.destination(Point.fromLngLat(4.0, 4.0))
696-
.addWaypointNames(longWpName.toString(), "Work")
697-
.baseUrl("https://foobar.com")
698-
.accessToken(ACCESS_TOKEN)
699-
.build();
700-
701-
assertTrue(mapboxDirections.cloneCall().request().url().toString()
702-
.contains("waypoint_names=Home"));
703-
704-
// one more char results in exception
705-
mapboxDirections = MapboxDirections.builder()
706-
.origin(Point.fromLngLat(2.0, 2.0))
707-
.destination(Point.fromLngLat(4.0, 4.0))
708-
.addWaypointNames(longWpName.toString(), "Work1")
709-
.baseUrl("https://foobar.com")
710-
.accessToken(ACCESS_TOKEN)
711-
.build();
712-
}
713-
714683
@Test
715684
public void testWithWaypointNames() throws Exception {
716685

services-matching/src/main/java/com/mapbox/api/matching/v5/MapboxMapMatching.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,9 +731,6 @@ public MapboxMapMatching build() {
731731
+ " the number of waypoints provided.");
732732
}
733733
final String waypointNamesStr = TextUtils.formatWaypointNames(waypointNames);
734-
if (!waypointNamesStr.isEmpty() && waypointNamesStr.length() > 500) {
735-
throw new ServicesException("Waypoint names exceed 500 character limit.");
736-
}
737734
waypointNames(waypointNamesStr);
738735
}
739736

services-matching/src/test/java/com/mapbox/api/matching/v5/MapboxMapMatchingTest.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -650,39 +650,6 @@ public void build_exceptionThrownWhenWaypointNamesDoNotMatchWaypoints() throws E
650650
.build();
651651
}
652652

653-
@Test
654-
public void build_exceptionThrownWhenWaypointNamesExceedLimit() throws Exception {
655-
thrown.expect(ServicesException.class);
656-
thrown.expectMessage(
657-
startsWith("Waypoint names exceed 500 character limit"));
658-
659-
StringBuilder longWpName = new StringBuilder();
660-
for (int i = 0; i < 124; i++) {
661-
longWpName.append("Home");
662-
}
663-
MapboxMapMatching mapMatching = MapboxMapMatching.builder()
664-
.baseUrl("https://foobar.com")
665-
.accessToken(ACCESS_TOKEN)
666-
.coordinate(Point.fromLngLat(2.0, 2.0))
667-
.coordinate(Point.fromLngLat(4.0, 4.0))
668-
.waypoints(0, 1)
669-
.addWaypointNames(longWpName.toString(), "Work")
670-
.build();
671-
672-
assertTrue(mapMatching.cloneCall().request().url().toString()
673-
.contains("waypoint_names=Home"));
674-
675-
// one more char results in exception
676-
mapMatching = MapboxMapMatching.builder()
677-
.baseUrl("https://foobar.com")
678-
.accessToken(ACCESS_TOKEN)
679-
.coordinate(Point.fromLngLat(2.0, 2.0))
680-
.coordinate(Point.fromLngLat(4.0, 4.0))
681-
.waypoints(0, 1)
682-
.addWaypointNames(longWpName.toString(), "Work1") // waypoint ar too long
683-
.build();
684-
}
685-
686653
@Test
687654
public void testWithWaypointNames() throws Exception {
688655

0 commit comments

Comments
 (0)