Skip to content

Commit e79e4e7

Browse files
author
Pablo Guardiola
authored
Revert "make directions waypoint name nullable as non-null breaks backwards compatibility (#1386)" (#1387)
This reverts commit 03a5554.
1 parent 03a5554 commit e79e4e7

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static Builder builder() {
3434
* @return string with the name of the way the coordinate snapped to
3535
* @since 1.0.0
3636
*/
37-
@Nullable
37+
@NonNull
3838
public abstract String name();
3939

4040
/**
@@ -121,7 +121,7 @@ public abstract static class Builder {
121121
* @since 3.0.0
122122
*/
123123
@NonNull
124-
public abstract Builder name(@Nullable String name);
124+
public abstract Builder name(@NonNull String name);
125125

126126
/**
127127
* The rawLocation as a double array representing a location snapped to the road network.

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.mapbox.geojson.Point;
66

77
import java.io.IOException;
8+
import java.util.Arrays;
89
import java.util.List;
910
import org.junit.Assert;
1011
import org.junit.Test;
@@ -21,8 +22,6 @@ public class DirectionsResponseTest extends TestUtils {
2122
private static final String DIRECTIONS_V5_MULTIPLE_ROUTES_WITH_OPTIONS =
2223
"directions_v5_multiple_routes_with_options.json";
2324
private static final String DIRECTIONS_V5_SILENT_WAYPOINT = "directions_v5_silent_waypoints.json";
24-
private static final String DIRECTIONS_WAYPOINTS_WITHOUT_NAMES =
25-
"directions_response_waypoints_without_names.json";
2625

2726
@Test
2827
public void sanity() throws Exception {
@@ -115,7 +114,7 @@ public void fromJson_deserializesOptions() throws Exception {
115114
}
116115

117116
@Test
118-
public void fromJson_deserializeViaWaypoints() throws IOException {
117+
public void fromJson_deserializeWiaWaypoints() throws IOException {
119118
String json = loadJsonFixture(DIRECTIONS_V5_SILENT_WAYPOINT);
120119

121120
DirectionsRoute route = DirectionsResponse.fromJson(json).routes().get(0);
@@ -139,14 +138,4 @@ public void fromToJsonForRouteWithSilentWaypoints() throws IOException {
139138

140139
assertEquals(initial, deserialized);
141140
}
142-
143-
@Test
144-
public void fromJson_deserializeWaypointsWithoutNames() throws Exception {
145-
String json = loadJsonFixture(DIRECTIONS_WAYPOINTS_WITHOUT_NAMES);
146-
147-
DirectionsResponse response = DirectionsResponse.fromJson(json);
148-
149-
assertNotNull(response);
150-
assertEquals(2, response.routes().size());
151-
}
152141
}

services-directions-models/src/test/resources/directions_response_waypoints_without_names.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)