MapMatchingMatching implements Serializable { @Nullable @SerializedName("voiceLocale") public abstract String voiceLanguage();  static Builder builder(); abstract double distance(); abstract double duration(); @Nullable abstract String geometry(); abstract double weight(); @SerializedName("weight_name") abstract String weightName(); abstract List<RouteLeg> legs(); abstract double confidence(); @Nullable abstract RouteOptions routeOptions(); @Nullable @SerializedName("voiceLocale") abstract String voiceLanguage(); abstract Builder toBuilder(); DirectionsRoute toDirectionRoute(); static TypeAdapter<MapMatchingMatching> typeAdapter(Gson gson);  }
@Test public void directionsRoute_doesReturnVoiceLocale() throws Exception { String json = loadJsonFixture(MAP_MATCHING_V5_VOICE_LANGUAGE_JSON); MapMatchingResponse response = MapMatchingResponse.fromJson(json); MapMatchingMatching matching = response.matchings().get(FIRST_ROUTE); String voiceLanguage = matching.voiceLanguage(); assertEquals("en-US", voiceLanguage); }
@Test public void directionsRouteWithInvalidLanguage_doesReturnNullVoiceLanguage() throws Exception { String json = loadJsonFixture(MAP_MATCHING_V5_INVALID_VOICE_LANGUAGE_JSON); MapMatchingResponse response = MapMatchingResponse.fromJson(json); MapMatchingMatching matching = response.matchings().get(FIRST_ROUTE); String voiceLanguage = matching.voiceLanguage(); assertNull(voiceLanguage); }