DirectionsWaypoint extends DirectionsJsonObject { public static DirectionsWaypoint fromJson(String json) { GsonBuilder gson = new GsonBuilder(); gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); return gson.create().fromJson(json, DirectionsWaypoint.class); }  static Builder builder(); @Nullable abstract String name(); @Nullable Point location(); abstract Builder toBuilder(); static TypeAdapter<DirectionsWaypoint> typeAdapter(Gson gson); static DirectionsWaypoint fromJson(String json);  }
@Test public void testFromJson() { String waypointJsonString = "{\"name\": \"Kirkjubøarvegur\", " + "\"location\": [ -6.80897, 62.000075] }"; DirectionsWaypoint waypoint = DirectionsWaypoint.fromJson(waypointJsonString); Point location = waypoint.location(); Assert.assertEquals(-6.80897, location.longitude(), 0.0001); Assert.assertEquals(62.000075, location.latitude(), 0.0001); String jsonStr = waypoint.toJson(); compareJson(waypointJsonString, jsonStr); }