Skip to content

Commit

Permalink
Revert "make directions waypoint name nullable as non-null breaks bac…
Browse files Browse the repository at this point in the history
…kwards compatibility (#1386)" (#1387)

This reverts commit 03a5554.
  • Loading branch information
Guardiola31337 authored Mar 30, 2022
1 parent 03a5554 commit e79e4e7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static Builder builder() {
* @return string with the name of the way the coordinate snapped to
* @since 1.0.0
*/
@Nullable
@NonNull
public abstract String name();

/**
Expand Down Expand Up @@ -121,7 +121,7 @@ public abstract static class Builder {
* @since 3.0.0
*/
@NonNull
public abstract Builder name(@Nullable String name);
public abstract Builder name(@NonNull String name);

/**
* The rawLocation as a double array representing a location snapped to the road network.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.mapbox.geojson.Point;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
Expand All @@ -21,8 +22,6 @@ public class DirectionsResponseTest extends TestUtils {
private static final String DIRECTIONS_V5_MULTIPLE_ROUTES_WITH_OPTIONS =
"directions_v5_multiple_routes_with_options.json";
private static final String DIRECTIONS_V5_SILENT_WAYPOINT = "directions_v5_silent_waypoints.json";
private static final String DIRECTIONS_WAYPOINTS_WITHOUT_NAMES =
"directions_response_waypoints_without_names.json";

@Test
public void sanity() throws Exception {
Expand Down Expand Up @@ -115,7 +114,7 @@ public void fromJson_deserializesOptions() throws Exception {
}

@Test
public void fromJson_deserializeViaWaypoints() throws IOException {
public void fromJson_deserializeWiaWaypoints() throws IOException {
String json = loadJsonFixture(DIRECTIONS_V5_SILENT_WAYPOINT);

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

assertEquals(initial, deserialized);
}

@Test
public void fromJson_deserializeWaypointsWithoutNames() throws Exception {
String json = loadJsonFixture(DIRECTIONS_WAYPOINTS_WITHOUT_NAMES);

DirectionsResponse response = DirectionsResponse.fromJson(json);

assertNotNull(response);
assertEquals(2, response.routes().size());
}
}

This file was deleted.

0 comments on commit e79e4e7

Please sign in to comment.