StepIntersection extends DirectionsJsonObject { public static StepIntersection fromJson(String json) { GsonBuilder gson = new GsonBuilder(); gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); return gson.create().fromJson(json, StepIntersection.class); }  static Builder builder(); @NonNull Point location(); @Nullable abstract List<Integer> bearings(); @Nullable abstract List<String> classes(); @Nullable abstract List<Boolean> entry(); @Nullable abstract Integer in(); @Nullable abstract Integer out(); @Nullable abstract List<IntersectionLanes> lanes(); @Nullable @SerializedName("geometry_index") abstract Integer geometryIndex(); @Nullable @SerializedName("is_urban") abstract Boolean isUrban(); @Nullable @SerializedName("admin_index") abstract Integer adminIndex(); @Nullable @SerializedName("rest_stop") abstract RestStop restStop(); @Nullable @SerializedName("toll_collection") abstract TollCollection tollCollection(); @Nullable @SerializedName("mapbox_streets_v8") abstract MapboxStreetsV8 mapboxStreetsV8(); @Nullable @SerializedName("tunnel_name") abstract String tunnelName(); abstract Builder toBuilder(); static TypeAdapter<StepIntersection> typeAdapter(Gson gson); static StepIntersection fromJson(String json);  }
@Test public void testFromJson() { String stepIntersectionJsonString = "{" + "\"location\": [ 13.426579, 52.508068 ]," + "\"bearings\": [ 125 ], " + "\"entry\": [true], " + "\"out\": 0, " + "\"geometry_index\": 123," + "\"is_urban\": true," + "\"mapbox_streets_v8\": {\"class\": \"street\"}," + "\"tunnel_name\": \"test tunnel name\"" + "}"; StepIntersection stepIntersection = StepIntersection.fromJson(stepIntersectionJsonString); assertEquals(123, stepIntersection.geometryIndex().intValue()); assertTrue(stepIntersection.isUrban()); assertEquals("street", stepIntersection.mapboxStreetsV8().roadClass()); assertEquals("test tunnel name", stepIntersection.tunnelName()); Point location = stepIntersection.location(); assertEquals(13.426579, location.longitude(), 0.0001); assertEquals(52.508068, location.latitude(), 0.0001); String jsonStr = stepIntersection.toJson(); compareJson(stepIntersectionJsonString, jsonStr); }