From f51e5d4ecdb9c3d410f09b2fa987145407ced4a0 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Tue, 7 Jan 2020 14:11:09 -0800 Subject: [PATCH 01/20] Add junction view api to directions --- .../v5/models/BannerInstructions.java | 22 +++ .../api/directions/v5/models/BannerView.java | 171 ++++++++++++++++++ .../v5/models/JunctionViewResponseTest.java | 49 +++++ .../banner_instruction_v5_junction_view.json | 1 + 4 files changed, 243 insertions(+) create mode 100644 services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java create mode 100644 services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java create mode 100644 services-directions/src/test/resources/banner_instruction_v5_junction_view.json diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java index 07ad50b5d..bca407216 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java @@ -70,6 +70,15 @@ public static Builder builder() { @Nullable public abstract BannerText sub(); + /** + * Visual representation of complex upcoming maneuver + * + * @return {@link BannerView} representing the secondary visual information + * @since 3.0.0 + */ + @Nullable + public abstract BannerView view(); + /** * Convert the current {@link BannerInstructions} to its builder holding the currently assigned * values. This allows you to modify a single property and then rebuild the object resulting in @@ -156,6 +165,19 @@ public abstract static class Builder { */ public abstract Builder sub(@Nullable BannerText sub); + /** + * Additional information that is included + * if we feel the driver needs a heads up about something. + * Can include information about the next maneuver (the one after the upcoming one), + * if the step is short - can be null, or can be lane information. + * If we have lane information, that trumps information about the next maneuver. + * @param view {@link BannerView} representing the sub visual information + * @return this builder for chaining options together + * @since ?? + */ + public abstract Builder view(@Nullable BannerView view); + + /** * Build a new {@link BannerInstructions} object. * diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java new file mode 100644 index 000000000..ae8203389 --- /dev/null +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java @@ -0,0 +1,171 @@ +package com.mapbox.api.directions.v5.models; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +import com.google.auto.value.AutoValue; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.SerializedName; +import com.mapbox.api.directions.v5.DirectionsAdapterFactory; +import com.mapbox.api.directions.v5.MapboxDirections; + +import java.util.List; + +/** + * Includes both plain text information that can be visualized inside your navigation application + * along with the text string broken down into {@link BannerComponents} which may or may not + * include a image url. To receive this information, your request must have + * {@link MapboxDirections#bannerInstructions()} set to true. + * + * @since 3.0.0 + */ +@AutoValue +public abstract class BannerView extends DirectionsJsonObject { + + /** + * Create a new instance of this class by using the {@link Builder} class. + * + * @return this classes {@link Builder} for creating a new instance + * @since 3.0.0 + */ + public static Builder builder() { + return new AutoValue_BannerView.Builder(); + } + + /** + * Plain text with all the {@link BannerComponents} text combined. + * + * @return plain text with all the {@link BannerComponents} text items combined + * @since 3.0.0 + */ + @NonNull + public abstract String text(); + + /** + * This indicates the type of maneuver. + * + * @return String with type of maneuver + * @see StepManeuver.StepManeuverType + * @since ?? + */ + @Nullable + @StepManeuver.StepManeuverType + public abstract String type(); + + /** + * This indicates the mode of the maneuver. If type is of turn, the modifier indicates the + * change in direction accomplished through the turn. If the type is of depart/arrive, the + * modifier indicates the position of waypoint from the current direction of travel. + * + * @return String with modifier + * @since ?? + */ + @Nullable + public abstract String modifier(); + + + /** + * The url of the junction view image. + * + * @return String representation of an image url + * @since ?? + */ + @Nullable + public abstract String url(); + + /** + * Convert the current {@link BannerView} to its builder holding the currently assigned + * values. This allows you to modify a single property and then rebuild the object resulting in + * an updated and modified {@link BannerView}. + * + * @return a {@link BannerView.Builder} with the same values set to match the ones defined + * in this {@link BannerView} + * @since ?? + */ + public abstract BannerView.Builder toBuilder(); + + /** + * Gson type adapter for parsing Gson to this class. + * + * @param gson the built {@link Gson} object + * @return the type adapter for this class + * @since 3.0.0 + */ + public static TypeAdapter typeAdapter(Gson gson) { + return new AutoValue_BannerView.GsonTypeAdapter(gson); + } + + /** + * Create a new instance of this class by passing in a formatted valid JSON String. + * + * @param json a formatted valid JSON string defining a BannerText + * @return a new instance of this class defined by the values passed inside this static factory + * method + * @since 3.4.0 + */ + public static BannerView fromJson(String json) { + GsonBuilder gson = new GsonBuilder(); + gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); + return gson.create().fromJson(json, BannerView.class); + } + + /** + * This builder can be used to set the values describing the {@link BannerView}. + * + * @since 3.0.0 + */ + @AutoValue.Builder + public abstract static class Builder { + + /** + * Plain text with all the {@link BannerComponents} text combined. + * + * @param text plain text with all the {@link BannerComponents} text items combined + * @return this builder for chaining options together + * @since 3.0.0 + */ + public abstract Builder text(@NonNull String text); + + /** + * This indicates the type of maneuver. See {@link BannerView#type()} for a full list of + * options. + * + * @param type String with type of maneuver + * @return this builder for chaining options together + * @see StepManeuver.StepManeuverType + * @since 3.0.0 + */ + public abstract Builder type(@Nullable @StepManeuver.StepManeuverType String type); + + /** + * This indicates the mode of the maneuver. If type is of turn, the modifier indicates the + * change in direction accomplished through the turn. If the type is of depart/arrive, the + * modifier indicates the position of waypoint from the current direction of travel. + * + * @param modifier String with modifier + * @return this builder for chaining options together + * @since 3.0.0 + */ + public abstract Builder modifier(@Nullable String modifier); + + /** + * The degrees at which you will be exiting a roundabout, assuming `180` indicates + * going straight through the roundabout. + * + * @param url at which you will be exiting a roundabout + * @return this builder for chaining options together + * @since ?? + */ + public abstract Builder url(String url); + + /** + * Build a new {@link BannerView} object. + * + * @return a new {@link BannerView} using the provided values in this builder + * @since 3.0.0 + */ + public abstract BannerView build(); + } +} diff --git a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java new file mode 100644 index 000000000..a1d8b8fa5 --- /dev/null +++ b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java @@ -0,0 +1,49 @@ +package com.mapbox.api.directions.v5.models; + +import com.mapbox.core.TestUtils; + +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.util.ArrayList; +import java.util.Scanner; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class JunctionViewResponseTest extends TestUtils { + + private static final String BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE = "banner_instruction_v5_junction_view.json"; + + File f = new File("src/banner_instruction_v5_junction_view.json.txt"); + + @Test + public void shouldReadBannerInstruction() throws Exception { + String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); + BannerInstructions response = BannerInstructions.fromJson(json); + assertNotNull(response); + } + + @Test + public void fromtestToFromJson() throws Exception { + String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); + BannerInstructions responseFromJson1 = BannerInstructions.fromJson(json); + + String jsonString = responseFromJson1.toJson(); + BannerInstructions responseFromJson2 = BannerInstructions.fromJson(jsonString); + + Assert.assertEquals(responseFromJson1, responseFromJson2); + Assert.assertEquals(responseFromJson2, responseFromJson1); + } + +// @Test +// public void testValuesFromJson() throws Exception { +// String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); +// BannerInstructions responseFromJson = BannerInstructions.fromJson(json); +// +//// responseFromJson.routes() +// Assert.assertEquals(responseFromJson.view().text(), "CA01610_1_E"); +// +// } +} diff --git a/services-directions/src/test/resources/banner_instruction_v5_junction_view.json b/services-directions/src/test/resources/banner_instruction_v5_junction_view.json new file mode 100644 index 000000000..793902e7b --- /dev/null +++ b/services-directions/src/test/resources/banner_instruction_v5_junction_view.json @@ -0,0 +1 @@ +{"distanceAlongGeometry":139.2,"primary":{"text":"E23","components":[{"text":"E23","type":"icon"}],"type":"fork","modifier":"right"},"secondary":{"text":"東名阪自動車道 / 亀山 / 四日市 / 東名阪自動車道","components":[{"text":"東名阪自動車道","type":"text"},{"text":"/","type":"text"},{"text":"亀山","type":"text"},{"text":"/","type":"text"},{"text":"四日市","type":"text"},{"text":"/","type":"text"},{"text":"東名阪自動車道","type":"text"}],"type":"fork","modifier":"right"},"view":{"text":"CA01610_1_E","components":[{"text":"CA01610_1_E","type":"guidance-view","url":"https://api-turn-here-staging-451578336.us-east-1.elb.amazonaws.com/guidance-views/v1/z/jct/CA01610_1_E"}],"type":"fork","modifier":"right"}} \ No newline at end of file From bfd5a9300f03a7185cf5e71614582179f6597566 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Tue, 7 Jan 2020 14:23:57 -0800 Subject: [PATCH 02/20] style fails --- .../v5/models/BannerInstructions.java | 3 ++- .../v5/models/JunctionViewResponseTest.java | 23 ++++++------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java index bca407216..f4d92fe13 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java @@ -2,6 +2,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; + import com.google.auto.value.AutoValue; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -71,7 +72,7 @@ public static Builder builder() { public abstract BannerText sub(); /** - * Visual representation of complex upcoming maneuver + * Visual representation of complex upcoming maneuver. * * @return {@link BannerView} representing the secondary visual information * @since 3.0.0 diff --git a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java index a1d8b8fa5..6adaccb8f 100644 --- a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java +++ b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java @@ -5,19 +5,12 @@ import org.junit.Assert; import org.junit.Test; -import java.io.File; -import java.util.ArrayList; -import java.util.Scanner; - -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; public class JunctionViewResponseTest extends TestUtils { private static final String BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE = "banner_instruction_v5_junction_view.json"; - File f = new File("src/banner_instruction_v5_junction_view.json.txt"); - @Test public void shouldReadBannerInstruction() throws Exception { String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); @@ -37,13 +30,11 @@ public void fromtestToFromJson() throws Exception { Assert.assertEquals(responseFromJson2, responseFromJson1); } -// @Test -// public void testValuesFromJson() throws Exception { -// String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); -// BannerInstructions responseFromJson = BannerInstructions.fromJson(json); -// -//// responseFromJson.routes() -// Assert.assertEquals(responseFromJson.view().text(), "CA01610_1_E"); -// -// } + @Test + public void testValuesFromJson() throws Exception { + String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); + BannerInstructions responseFromJson = BannerInstructions.fromJson(json); + + Assert.assertEquals(responseFromJson.view().text(), "CA01610_1_E"); + } } From 717f1e406b6aae34cdceef92ec9a6461a7456998 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Tue, 7 Jan 2020 14:33:24 -0800 Subject: [PATCH 03/20] imports --- .../java/com/mapbox/api/directions/v5/models/BannerView.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java index ae8203389..b1501e5fd 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java @@ -7,12 +7,9 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; import com.mapbox.api.directions.v5.DirectionsAdapterFactory; import com.mapbox.api.directions.v5.MapboxDirections; -import java.util.List; - /** * Includes both plain text information that can be visualized inside your navigation application * along with the text string broken down into {@link BannerComponents} which may or may not From 377846692617309bbd1b64ee366c3049069dae4b Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Tue, 7 Jan 2020 14:41:40 -0800 Subject: [PATCH 04/20] test the tests --- .../api/directions/v5/models/JunctionViewResponseTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java index 6adaccb8f..33aa57182 100644 --- a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java +++ b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java @@ -37,4 +37,9 @@ public void testValuesFromJson() throws Exception { Assert.assertEquals(responseFromJson.view().text(), "CA01610_1_E"); } + + @Test + public void testFailureTest() { + Assert.assertEquals("Kyle", "Not Kyle"); + } } From 2ad0056b9b075541733db7eb813f6ee3e1214dc4 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Tue, 7 Jan 2020 14:59:44 -0800 Subject: [PATCH 05/20] add components --- .../api/directions/v5/models/BannerView.java | 36 ++++++++++++++----- .../v5/models/JunctionViewResponseTest.java | 16 ++++++--- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java index b1501e5fd..ececbd958 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java @@ -10,6 +10,8 @@ import com.mapbox.api.directions.v5.DirectionsAdapterFactory; import com.mapbox.api.directions.v5.MapboxDirections; +import java.util.List; + /** * Includes both plain text information that can be visualized inside your navigation application * along with the text string broken down into {@link BannerComponents} which may or may not @@ -35,11 +37,20 @@ public static Builder builder() { * Plain text with all the {@link BannerComponents} text combined. * * @return plain text with all the {@link BannerComponents} text items combined - * @since 3.0.0 + * @since ?? */ @NonNull public abstract String text(); + /** + * A part or element of the {@link BannerInstructions}. + * + * @return a {@link BannerComponents} specific to a {@link LegStep} + * @since ?? + */ + @Nullable + public abstract List components(); + /** * This indicates the type of maneuver. * @@ -88,7 +99,7 @@ public static Builder builder() { * * @param gson the built {@link Gson} object * @return the type adapter for this class - * @since 3.0.0 + * @since ?? */ public static TypeAdapter typeAdapter(Gson gson) { return new AutoValue_BannerView.GsonTypeAdapter(gson); @@ -100,7 +111,7 @@ public static TypeAdapter typeAdapter(Gson gson) { * @param json a formatted valid JSON string defining a BannerText * @return a new instance of this class defined by the values passed inside this static factory * method - * @since 3.4.0 + * @since ?? */ public static BannerView fromJson(String json) { GsonBuilder gson = new GsonBuilder(); @@ -111,7 +122,7 @@ public static BannerView fromJson(String json) { /** * This builder can be used to set the values describing the {@link BannerView}. * - * @since 3.0.0 + * @since ?? */ @AutoValue.Builder public abstract static class Builder { @@ -121,10 +132,19 @@ public abstract static class Builder { * * @param text plain text with all the {@link BannerComponents} text items combined * @return this builder for chaining options together - * @since 3.0.0 + * @since ?? */ public abstract Builder text(@NonNull String text); + /** + * A part or element of the {@link BannerInstructions}. + * + * @param components a {@link BannerComponents} specific to a {@link LegStep} + * @return this builder for chaining options together + * @since ?? + */ + public abstract Builder components(List components); + /** * This indicates the type of maneuver. See {@link BannerView#type()} for a full list of * options. @@ -132,7 +152,7 @@ public abstract static class Builder { * @param type String with type of maneuver * @return this builder for chaining options together * @see StepManeuver.StepManeuverType - * @since 3.0.0 + * @since ?? */ public abstract Builder type(@Nullable @StepManeuver.StepManeuverType String type); @@ -143,7 +163,7 @@ public abstract static class Builder { * * @param modifier String with modifier * @return this builder for chaining options together - * @since 3.0.0 + * @since ?? */ public abstract Builder modifier(@Nullable String modifier); @@ -161,7 +181,7 @@ public abstract static class Builder { * Build a new {@link BannerView} object. * * @return a new {@link BannerView} using the provided values in this builder - * @since 3.0.0 + * @since ?? */ public abstract BannerView build(); } diff --git a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java index 33aa57182..b22d3b427 100644 --- a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java +++ b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java @@ -5,6 +5,8 @@ import org.junit.Assert; import org.junit.Test; +import java.util.List; + import static org.junit.Assert.assertNotNull; public class JunctionViewResponseTest extends TestUtils { @@ -35,11 +37,15 @@ public void testValuesFromJson() throws Exception { String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); BannerInstructions responseFromJson = BannerInstructions.fromJson(json); - Assert.assertEquals(responseFromJson.view().text(), "CA01610_1_E"); - } + BannerView bannerView = responseFromJson.view(); + Assert.assertEquals(bannerView.text(), "CA01610_1_E"); + Assert.assertEquals(bannerView.type(), "fork"); + Assert.assertEquals(bannerView.modifier(), "right"); - @Test - public void testFailureTest() { - Assert.assertEquals("Kyle", "Not Kyle"); + List bannerComponents = responseFromJson.view().components(); + Assert.assertEquals(bannerComponents.size(), 1); + Assert.assertEquals(bannerComponents.get(0).text(), "CA01610_1_E"); + Assert.assertEquals(bannerComponents.get(0).type(), "guidance-view"); + // TODO add the url check } } From 7a0a5c4666a51e9976ca1d06b7b8cbe75a4d04cd Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Tue, 7 Jan 2020 15:02:45 -0800 Subject: [PATCH 06/20] test utils wont work locally --- .../v5/models/JunctionViewResponseTest.java | 21 +++++++------------ .../banner_instruction_v5_junction_view.json | 1 - 2 files changed, 8 insertions(+), 14 deletions(-) delete mode 100644 services-directions/src/test/resources/banner_instruction_v5_junction_view.json diff --git a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java index b22d3b427..5cc945d56 100644 --- a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java +++ b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java @@ -1,7 +1,5 @@ package com.mapbox.api.directions.v5.models; -import com.mapbox.core.TestUtils; - import org.junit.Assert; import org.junit.Test; @@ -9,21 +7,19 @@ import static org.junit.Assert.assertNotNull; -public class JunctionViewResponseTest extends TestUtils { +public class JunctionViewResponseTest { - private static final String BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE = "banner_instruction_v5_junction_view.json"; + private static final String BANNER_INSTRUCTION_JSON = "{\"distanceAlongGeometry\":139.2,\"primary\":{\"text\":\"E23\",\"components\":[{\"text\":\"E23\",\"type\":\"icon\"}],\"type\":\"fork\",\"modifier\":\"right\"},\"secondary\":{\"text\":\"東名阪自動車道 / 亀山 / 四日市 / 東名阪自動車道\",\"components\":[{\"text\":\"東名阪自動車道\",\"type\":\"text\"},{\"text\":\"/\",\"type\":\"text\"},{\"text\":\"亀山\",\"type\":\"text\"},{\"text\":\"/\",\"type\":\"text\"},{\"text\":\"四日市\",\"type\":\"text\"},{\"text\":\"/\",\"type\":\"text\"},{\"text\":\"東名阪自動車道\",\"type\":\"text\"}],\"type\":\"fork\",\"modifier\":\"right\"},\"view\":{\"text\":\"CA01610_1_E\",\"components\":[{\"text\":\"CA01610_1_E\",\"type\":\"guidance-view\",\"url\":\"https://api-turn-here-staging-451578336.us-east-1.elb.amazonaws.com/guidance-views/v1/z/jct/CA01610_1_E\"}],\"type\":\"fork\",\"modifier\":\"right\"}}"; @Test - public void shouldReadBannerInstruction() throws Exception { - String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); - BannerInstructions response = BannerInstructions.fromJson(json); + public void shouldReadBannerInstruction() { + BannerInstructions response = BannerInstructions.fromJson(BANNER_INSTRUCTION_JSON); assertNotNull(response); } @Test - public void fromtestToFromJson() throws Exception { - String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); - BannerInstructions responseFromJson1 = BannerInstructions.fromJson(json); + public void fromtestToFromJson() { + BannerInstructions responseFromJson1 = BannerInstructions.fromJson(BANNER_INSTRUCTION_JSON); String jsonString = responseFromJson1.toJson(); BannerInstructions responseFromJson2 = BannerInstructions.fromJson(jsonString); @@ -33,9 +29,8 @@ public void fromtestToFromJson() throws Exception { } @Test - public void testValuesFromJson() throws Exception { - String json = loadJsonFixture(BANNER_INSTRUCTION_V5_JUNCTION_VIEW_FIXTURE); - BannerInstructions responseFromJson = BannerInstructions.fromJson(json); + public void testValuesFromJson() { + BannerInstructions responseFromJson = BannerInstructions.fromJson(BANNER_INSTRUCTION_JSON); BannerView bannerView = responseFromJson.view(); Assert.assertEquals(bannerView.text(), "CA01610_1_E"); diff --git a/services-directions/src/test/resources/banner_instruction_v5_junction_view.json b/services-directions/src/test/resources/banner_instruction_v5_junction_view.json deleted file mode 100644 index 793902e7b..000000000 --- a/services-directions/src/test/resources/banner_instruction_v5_junction_view.json +++ /dev/null @@ -1 +0,0 @@ -{"distanceAlongGeometry":139.2,"primary":{"text":"E23","components":[{"text":"E23","type":"icon"}],"type":"fork","modifier":"right"},"secondary":{"text":"東名阪自動車道 / 亀山 / 四日市 / 東名阪自動車道","components":[{"text":"東名阪自動車道","type":"text"},{"text":"/","type":"text"},{"text":"亀山","type":"text"},{"text":"/","type":"text"},{"text":"四日市","type":"text"},{"text":"/","type":"text"},{"text":"東名阪自動車道","type":"text"}],"type":"fork","modifier":"right"},"view":{"text":"CA01610_1_E","components":[{"text":"CA01610_1_E","type":"guidance-view","url":"https://api-turn-here-staging-451578336.us-east-1.elb.amazonaws.com/guidance-views/v1/z/jct/CA01610_1_E"}],"type":"fork","modifier":"right"}} \ No newline at end of file From 7871fe62d8c4b3f3a912f2bb312ca018672babea Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Tue, 7 Jan 2020 15:06:07 -0800 Subject: [PATCH 07/20] find replace version tag --- .../v5/models/BannerInstructions.java | 4 +-- .../api/directions/v5/models/BannerView.java | 34 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java index f4d92fe13..ebf45d502 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java @@ -75,7 +75,7 @@ public static Builder builder() { * Visual representation of complex upcoming maneuver. * * @return {@link BannerView} representing the secondary visual information - * @since 3.0.0 + * @since REPLACE_VERSION_KYLE */ @Nullable public abstract BannerView view(); @@ -174,7 +174,7 @@ public abstract static class Builder { * If we have lane information, that trumps information about the next maneuver. * @param view {@link BannerView} representing the sub visual information * @return this builder for chaining options together - * @since ?? + * @since REPLACE_VERSION_KYLE */ public abstract Builder view(@Nullable BannerView view); diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java index ececbd958..7b6084422 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java @@ -18,7 +18,7 @@ * include a image url. To receive this information, your request must have * {@link MapboxDirections#bannerInstructions()} set to true. * - * @since 3.0.0 + * @since REPLACE_VERSION_KYLE */ @AutoValue public abstract class BannerView extends DirectionsJsonObject { @@ -27,7 +27,7 @@ public abstract class BannerView extends DirectionsJsonObject { * Create a new instance of this class by using the {@link Builder} class. * * @return this classes {@link Builder} for creating a new instance - * @since 3.0.0 + * @since REPLACE_VERSION_KYLE */ public static Builder builder() { return new AutoValue_BannerView.Builder(); @@ -37,7 +37,7 @@ public static Builder builder() { * Plain text with all the {@link BannerComponents} text combined. * * @return plain text with all the {@link BannerComponents} text items combined - * @since ?? + * @since REPLACE_VERSION_KYLE */ @NonNull public abstract String text(); @@ -46,7 +46,7 @@ public static Builder builder() { * A part or element of the {@link BannerInstructions}. * * @return a {@link BannerComponents} specific to a {@link LegStep} - * @since ?? + * @since REPLACE_VERSION_KYLE */ @Nullable public abstract List components(); @@ -56,7 +56,7 @@ public static Builder builder() { * * @return String with type of maneuver * @see StepManeuver.StepManeuverType - * @since ?? + * @since REPLACE_VERSION_KYLE */ @Nullable @StepManeuver.StepManeuverType @@ -68,7 +68,7 @@ public static Builder builder() { * modifier indicates the position of waypoint from the current direction of travel. * * @return String with modifier - * @since ?? + * @since REPLACE_VERSION_KYLE */ @Nullable public abstract String modifier(); @@ -78,7 +78,7 @@ public static Builder builder() { * The url of the junction view image. * * @return String representation of an image url - * @since ?? + * @since REPLACE_VERSION_KYLE */ @Nullable public abstract String url(); @@ -90,7 +90,7 @@ public static Builder builder() { * * @return a {@link BannerView.Builder} with the same values set to match the ones defined * in this {@link BannerView} - * @since ?? + * @since REPLACE_VERSION_KYLE */ public abstract BannerView.Builder toBuilder(); @@ -99,7 +99,7 @@ public static Builder builder() { * * @param gson the built {@link Gson} object * @return the type adapter for this class - * @since ?? + * @since REPLACE_VERSION_KYLE */ public static TypeAdapter typeAdapter(Gson gson) { return new AutoValue_BannerView.GsonTypeAdapter(gson); @@ -111,7 +111,7 @@ public static TypeAdapter typeAdapter(Gson gson) { * @param json a formatted valid JSON string defining a BannerText * @return a new instance of this class defined by the values passed inside this static factory * method - * @since ?? + * @since REPLACE_VERSION_KYLE */ public static BannerView fromJson(String json) { GsonBuilder gson = new GsonBuilder(); @@ -122,7 +122,7 @@ public static BannerView fromJson(String json) { /** * This builder can be used to set the values describing the {@link BannerView}. * - * @since ?? + * @since REPLACE_VERSION_KYLE */ @AutoValue.Builder public abstract static class Builder { @@ -132,7 +132,7 @@ public abstract static class Builder { * * @param text plain text with all the {@link BannerComponents} text items combined * @return this builder for chaining options together - * @since ?? + * @since REPLACE_VERSION_KYLE */ public abstract Builder text(@NonNull String text); @@ -141,7 +141,7 @@ public abstract static class Builder { * * @param components a {@link BannerComponents} specific to a {@link LegStep} * @return this builder for chaining options together - * @since ?? + * @since REPLACE_VERSION_KYLE */ public abstract Builder components(List components); @@ -152,7 +152,7 @@ public abstract static class Builder { * @param type String with type of maneuver * @return this builder for chaining options together * @see StepManeuver.StepManeuverType - * @since ?? + * @since REPLACE_VERSION_KYLE */ public abstract Builder type(@Nullable @StepManeuver.StepManeuverType String type); @@ -163,7 +163,7 @@ public abstract static class Builder { * * @param modifier String with modifier * @return this builder for chaining options together - * @since ?? + * @since REPLACE_VERSION_KYLE */ public abstract Builder modifier(@Nullable String modifier); @@ -173,7 +173,7 @@ public abstract static class Builder { * * @param url at which you will be exiting a roundabout * @return this builder for chaining options together - * @since ?? + * @since REPLACE_VERSION_KYLE */ public abstract Builder url(String url); @@ -181,7 +181,7 @@ public abstract static class Builder { * Build a new {@link BannerView} object. * * @return a new {@link BannerView} using the provided values in this builder - * @since ?? + * @since REPLACE_VERSION_KYLE */ public abstract BannerView build(); } From 97bb4bffeb51e4e68c37888dd2dbc734f39a2927 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Tue, 7 Jan 2020 15:20:16 -0800 Subject: [PATCH 08/20] remove --- .../api/directions/v5/models/BannerView.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java index 7b6084422..b5c29bdee 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java @@ -73,16 +73,6 @@ public static Builder builder() { @Nullable public abstract String modifier(); - - /** - * The url of the junction view image. - * - * @return String representation of an image url - * @since REPLACE_VERSION_KYLE - */ - @Nullable - public abstract String url(); - /** * Convert the current {@link BannerView} to its builder holding the currently assigned * values. This allows you to modify a single property and then rebuild the object resulting in @@ -167,16 +157,6 @@ public abstract static class Builder { */ public abstract Builder modifier(@Nullable String modifier); - /** - * The degrees at which you will be exiting a roundabout, assuming `180` indicates - * going straight through the roundabout. - * - * @param url at which you will be exiting a roundabout - * @return this builder for chaining options together - * @since REPLACE_VERSION_KYLE - */ - public abstract Builder url(String url); - /** * Build a new {@link BannerView} object. * From 90933d64a7aed521b75632cfa752ad0697866709 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 09:58:57 -0800 Subject: [PATCH 09/20] update version --- .../v5/models/BannerInstructions.java | 4 +-- .../api/directions/v5/models/BannerView.java | 30 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java index ebf45d502..db851062f 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java @@ -75,7 +75,7 @@ public static Builder builder() { * Visual representation of complex upcoming maneuver. * * @return {@link BannerView} representing the secondary visual information - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ @Nullable public abstract BannerView view(); @@ -174,7 +174,7 @@ public abstract static class Builder { * If we have lane information, that trumps information about the next maneuver. * @param view {@link BannerView} representing the sub visual information * @return this builder for chaining options together - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public abstract Builder view(@Nullable BannerView view); diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java index b5c29bdee..1b0f9f703 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerView.java @@ -18,7 +18,7 @@ * include a image url. To receive this information, your request must have * {@link MapboxDirections#bannerInstructions()} set to true. * - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ @AutoValue public abstract class BannerView extends DirectionsJsonObject { @@ -27,7 +27,7 @@ public abstract class BannerView extends DirectionsJsonObject { * Create a new instance of this class by using the {@link Builder} class. * * @return this classes {@link Builder} for creating a new instance - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public static Builder builder() { return new AutoValue_BannerView.Builder(); @@ -37,7 +37,7 @@ public static Builder builder() { * Plain text with all the {@link BannerComponents} text combined. * * @return plain text with all the {@link BannerComponents} text items combined - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ @NonNull public abstract String text(); @@ -46,7 +46,7 @@ public static Builder builder() { * A part or element of the {@link BannerInstructions}. * * @return a {@link BannerComponents} specific to a {@link LegStep} - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ @Nullable public abstract List components(); @@ -56,7 +56,7 @@ public static Builder builder() { * * @return String with type of maneuver * @see StepManeuver.StepManeuverType - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ @Nullable @StepManeuver.StepManeuverType @@ -68,7 +68,7 @@ public static Builder builder() { * modifier indicates the position of waypoint from the current direction of travel. * * @return String with modifier - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ @Nullable public abstract String modifier(); @@ -80,7 +80,7 @@ public static Builder builder() { * * @return a {@link BannerView.Builder} with the same values set to match the ones defined * in this {@link BannerView} - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public abstract BannerView.Builder toBuilder(); @@ -89,7 +89,7 @@ public static Builder builder() { * * @param gson the built {@link Gson} object * @return the type adapter for this class - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public static TypeAdapter typeAdapter(Gson gson) { return new AutoValue_BannerView.GsonTypeAdapter(gson); @@ -101,7 +101,7 @@ public static TypeAdapter typeAdapter(Gson gson) { * @param json a formatted valid JSON string defining a BannerText * @return a new instance of this class defined by the values passed inside this static factory * method - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public static BannerView fromJson(String json) { GsonBuilder gson = new GsonBuilder(); @@ -112,7 +112,7 @@ public static BannerView fromJson(String json) { /** * This builder can be used to set the values describing the {@link BannerView}. * - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ @AutoValue.Builder public abstract static class Builder { @@ -122,7 +122,7 @@ public abstract static class Builder { * * @param text plain text with all the {@link BannerComponents} text items combined * @return this builder for chaining options together - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public abstract Builder text(@NonNull String text); @@ -131,7 +131,7 @@ public abstract static class Builder { * * @param components a {@link BannerComponents} specific to a {@link LegStep} * @return this builder for chaining options together - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public abstract Builder components(List components); @@ -142,7 +142,7 @@ public abstract static class Builder { * @param type String with type of maneuver * @return this builder for chaining options together * @see StepManeuver.StepManeuverType - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public abstract Builder type(@Nullable @StepManeuver.StepManeuverType String type); @@ -153,7 +153,7 @@ public abstract static class Builder { * * @param modifier String with modifier * @return this builder for chaining options together - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public abstract Builder modifier(@Nullable String modifier); @@ -161,7 +161,7 @@ public abstract static class Builder { * Build a new {@link BannerView} object. * * @return a new {@link BannerView} using the provided values in this builder - * @since REPLACE_VERSION_KYLE + * @since 5.0.0 */ public abstract BannerView build(); } From c4230dd6bc63bf9331554f2311f8906b3352947b Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 10:29:00 -0800 Subject: [PATCH 10/20] add imageURL parameter --- .../v5/models/BannerComponents.java | 22 +++++++++++++++++++ .../v5/models/JunctionViewResponseTest.java | 12 +++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java index ed4de2e2a..a3d01bd7c 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java @@ -107,6 +107,18 @@ public static Builder builder() { @SerializedName("imageBaseURL") public abstract String imageBaseUrl(); + /** + * An image associated with the banner component. Unlike the imageBaseUrl, + * this image url does not include image density encodings. + * + * @return the url which can be used to download the image. + * @since 5.0.0 + */ + @Nullable + @SerializedName("imageURL") + public abstract String imageUrl(); + + /** * A List of directions indicating which way you can go from a lane * (left, right, or straight). If the value is ['left', 'straight'], @@ -269,6 +281,16 @@ public abstract static class Builder { */ public abstract Builder imageBaseUrl(@Nullable String imageBaseUrl); + /** + * An image associated with the banner component. Unlike the imageBaseUrl, + * this image url does not include image density encodings. + * + * @param imageUrl the url which can be used to download the image + * @return this builder for chaining options together + * @since 5.0.0 + */ + public abstract Builder imageUrl(@Nullable String imageUrl); + /** * A List of directions indicating which way you can go from a lane * (left, right, or straight). If the value is ['left', 'straight'], diff --git a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java index 5cc945d56..f055282db 100644 --- a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java +++ b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java @@ -9,7 +9,7 @@ public class JunctionViewResponseTest { - private static final String BANNER_INSTRUCTION_JSON = "{\"distanceAlongGeometry\":139.2,\"primary\":{\"text\":\"E23\",\"components\":[{\"text\":\"E23\",\"type\":\"icon\"}],\"type\":\"fork\",\"modifier\":\"right\"},\"secondary\":{\"text\":\"東名阪自動車道 / 亀山 / 四日市 / 東名阪自動車道\",\"components\":[{\"text\":\"東名阪自動車道\",\"type\":\"text\"},{\"text\":\"/\",\"type\":\"text\"},{\"text\":\"亀山\",\"type\":\"text\"},{\"text\":\"/\",\"type\":\"text\"},{\"text\":\"四日市\",\"type\":\"text\"},{\"text\":\"/\",\"type\":\"text\"},{\"text\":\"東名阪自動車道\",\"type\":\"text\"}],\"type\":\"fork\",\"modifier\":\"right\"},\"view\":{\"text\":\"CA01610_1_E\",\"components\":[{\"text\":\"CA01610_1_E\",\"type\":\"guidance-view\",\"url\":\"https://api-turn-here-staging-451578336.us-east-1.elb.amazonaws.com/guidance-views/v1/z/jct/CA01610_1_E\"}],\"type\":\"fork\",\"modifier\":\"right\"}}"; + private static final String BANNER_INSTRUCTION_JSON = "{\"distanceAlongGeometry\":139.2,\"primary\":{\"text\":\"E23\",\"components\":[{\"text\":\"E23\",\"type\":\"icon\"}],\"type\":\"fork\",\"modifier\":\"right\"},\"secondary\":{\"text\":\"東名阪自動車道 / 亀山 / 四日市 / 東名阪自動車道\",\"components\":[{\"text\":\"東名阪自動車道\",\"type\":\"text\"},{\"text\":\"/\",\"type\":\"text\"},{\"text\":\"亀山\",\"type\":\"text\"},{\"text\":\"/\",\"type\":\"text\"},{\"text\":\"四日市\",\"type\":\"text\"},{\"text\":\"/\",\"type\":\"text\"},{\"text\":\"東名阪自動車道\",\"type\":\"text\"}],\"type\":\"fork\",\"modifier\":\"right\"},\"view\":{\"text\":\"CA01610_1_E\",\"components\":[{\"text\":\"CA01610_1_E\",\"type\":\"guidance-view\",\"imageURL\":\"https://api-turn-here-staging-451578336.us-east-1.elb.amazonaws.com/guidance-views/v1/z/jct/CA01610_1_E\"}],\"type\":\"fork\",\"modifier\":\"right\"}}"; @Test public void shouldReadBannerInstruction() { @@ -37,10 +37,10 @@ public void testValuesFromJson() { Assert.assertEquals(bannerView.type(), "fork"); Assert.assertEquals(bannerView.modifier(), "right"); - List bannerComponents = responseFromJson.view().components(); - Assert.assertEquals(bannerComponents.size(), 1); - Assert.assertEquals(bannerComponents.get(0).text(), "CA01610_1_E"); - Assert.assertEquals(bannerComponents.get(0).type(), "guidance-view"); - // TODO add the url check + Assert.assertEquals(responseFromJson.view().components().size(), 1); + BannerComponents bannerComponent = responseFromJson.view().components().get(0); + Assert.assertEquals(bannerComponent.text(), "CA01610_1_E"); + Assert.assertEquals(bannerComponent.type(), "guidance-view"); + Assert.assertEquals(bannerComponent.imageUrl(), "https://api-turn-here-staging-451578336.us-east-1.elb.amazonaws.com/guidance-views/v1/z/jct/CA01610_1_E"); } } From 5c3780a29bb9a62e64a4f47c0603cc058919d2ae Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 10:44:44 -0800 Subject: [PATCH 11/20] another description --- .../api/directions/v5/models/BannerComponents.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java index a3d01bd7c..afce687ad 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java @@ -108,8 +108,9 @@ public static Builder builder() { public abstract String imageBaseUrl(); /** - * An image associated with the banner component. Unlike the imageBaseUrl, - * this image url does not include image density encodings. + * In some cases when the {@link StepManeuver} will be difficult to navigate, an image + * can describe how to proceed. The domain name for this image is a Junction View. + * Unlike the imageBaseUrl, this image url does not include image density encodings. * * @return the url which can be used to download the image. * @since 5.0.0 @@ -282,8 +283,9 @@ public abstract static class Builder { public abstract Builder imageBaseUrl(@Nullable String imageBaseUrl); /** - * An image associated with the banner component. Unlike the imageBaseUrl, - * this image url does not include image density encodings. + * In some cases when the {@link StepManeuver} will be difficult to navigate, an image + * can describe how to proceed. The domain name for this image is a Junction View. + * Unlike the imageBaseUrl, this image url does not include image density encodings. * * @param imageUrl the url which can be used to download the image * @return this builder for chaining options together From 80a3531a5438cb76c12b2733d1a87d4c2a981091 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 11:36:58 -0800 Subject: [PATCH 12/20] update description --- .../mapbox/api/directions/v5/models/BannerInstructions.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java index db851062f..3d7996368 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java @@ -72,7 +72,9 @@ public static Builder builder() { public abstract BannerText sub(); /** - * Visual representation of complex upcoming maneuver. + * Optional image to display for an upcoming maneuver. Used to provide a visual + * for complex junctions and maneuver. If the step is short the image should be displayed + * for the duration of the step, otherwise it is shown as you approach the maneuver. * * @return {@link BannerView} representing the secondary visual information * @since 5.0.0 From 6edfd1c149e4eee9eaa6c1a8b785be884da0822a Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 11:39:10 -0800 Subject: [PATCH 13/20] update comment --- .../api/directions/v5/models/BannerInstructions.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java index 3d7996368..c2525c505 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java @@ -65,6 +65,7 @@ public static Builder builder() { * Can include information about the next maneuver (the one after the upcoming one), * if the step is short - can be null, or can be lane information. * If we have lane information, that trumps information about the next maneuver. + * * @return {@link BannerText} representing the sub visual information * @since 3.2.0 */ @@ -162,6 +163,7 @@ public abstract static class Builder { * Can include information about the next maneuver (the one after the upcoming one), * if the step is short - can be null, or can be lane information. * If we have lane information, that trumps information about the next maneuver. + * * @param sub {@link BannerText} representing the sub visual information * @return {@link BannerText} representing the sub visual information * @since 3.2.0 @@ -169,11 +171,10 @@ public abstract static class Builder { public abstract Builder sub(@Nullable BannerText sub); /** - * Additional information that is included - * if we feel the driver needs a heads up about something. - * Can include information about the next maneuver (the one after the upcoming one), - * if the step is short - can be null, or can be lane information. - * If we have lane information, that trumps information about the next maneuver. + * Optional image to display for an upcoming maneuver. Used to provide a visual + * for complex junctions and maneuver. If the step is short the image should be displayed + * for the duration of the step, otherwise it is shown as you approach the maneuver. + * * @param view {@link BannerView} representing the sub visual information * @return this builder for chaining options together * @since 5.0.0 From aa54ecdf3f1cfdaf6944afcb2c1c71e30779ecde Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 11:42:24 -0800 Subject: [PATCH 14/20] remove new line --- .../mapbox/api/directions/v5/models/BannerInstructions.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java index c2525c505..97e90be04 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java @@ -180,8 +180,7 @@ public abstract static class Builder { * @since 5.0.0 */ public abstract Builder view(@Nullable BannerView view); - - + /** * Build a new {@link BannerInstructions} object. * From 8cfb1f0e2935b5d44adc80d9f81d242198f3c987 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 14:28:52 -0800 Subject: [PATCH 15/20] remove line --- .../com/mapbox/api/directions/v5/models/BannerInstructions.java | 1 - 1 file changed, 1 deletion(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java index 97e90be04..c96c23ede 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java @@ -105,7 +105,6 @@ public static TypeAdapter typeAdapter(Gson gson) { return new AutoValue_BannerInstructions.GsonTypeAdapter(gson); } - /** * Create a new instance of this class by passing in a formatted valid JSON String. * From a027edcf83e318703485296f1537f5c99b5f8cfc Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 14:34:58 -0800 Subject: [PATCH 16/20] add guidance view type --- .../api/directions/v5/models/BannerComponents.java | 10 +++++++++- .../directions/v5/models/JunctionViewResponseTest.java | 4 +--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java index 530fbc36c..b13b5f5c2 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java @@ -70,6 +70,13 @@ public abstract class BannerComponents extends DirectionsJsonObject */ public static final String LANE = "lane"; + /** + * This view gives guidance through junctions and is used to complete maneuvers. + * + * @since 3.0.0 + */ + public static final String GUIDANCE_VIEW = "guidance-view"; + /** * Banner component types. * https://docs.mapbox.com/api/navigation/#banner-instruction-object @@ -83,7 +90,8 @@ public abstract class BannerComponents extends DirectionsJsonObject DELIMITER, EXIT_NUMBER, EXIT, - LANE + LANE, + GUIDANCE_VIEW }) public @interface BannerComponentsType { } diff --git a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java index f055282db..99782726f 100644 --- a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java +++ b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java @@ -3,8 +3,6 @@ import org.junit.Assert; import org.junit.Test; -import java.util.List; - import static org.junit.Assert.assertNotNull; public class JunctionViewResponseTest { @@ -40,7 +38,7 @@ public void testValuesFromJson() { Assert.assertEquals(responseFromJson.view().components().size(), 1); BannerComponents bannerComponent = responseFromJson.view().components().get(0); Assert.assertEquals(bannerComponent.text(), "CA01610_1_E"); - Assert.assertEquals(bannerComponent.type(), "guidance-view"); + Assert.assertEquals(bannerComponent.type(), BannerComponents.GUIDANCE_VIEW); Assert.assertEquals(bannerComponent.imageUrl(), "https://api-turn-here-staging-451578336.us-east-1.elb.amazonaws.com/guidance-views/v1/z/jct/CA01610_1_E"); } } From d5fd7a3fadc3ee12d4c017000b1c6bd05822b5b3 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 14:36:03 -0800 Subject: [PATCH 17/20] remove new line --- .../com/mapbox/api/directions/v5/models/BannerComponents.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java index b13b5f5c2..efc96665a 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java @@ -190,8 +190,7 @@ public static Builder builder() { @Nullable @SerializedName("imageURL") public abstract String imageUrl(); - - + /** * A List of directions indicating which way you can go from a lane * (left, right, or straight). If the value is ['left', 'straight'], From 3306864755eab14506a39619f585befcbef86cc7 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 14:41:02 -0800 Subject: [PATCH 18/20] what --- .../com/mapbox/api/directions/v5/models/BannerComponents.java | 2 +- .../com/mapbox/api/directions/v5/models/BannerInstructions.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java index efc96665a..666569f37 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java @@ -190,7 +190,7 @@ public static Builder builder() { @Nullable @SerializedName("imageURL") public abstract String imageUrl(); - + /** * A List of directions indicating which way you can go from a lane * (left, right, or straight). If the value is ['left', 'straight'], diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java index c96c23ede..757278fa3 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerInstructions.java @@ -179,7 +179,7 @@ public abstract static class Builder { * @since 5.0.0 */ public abstract Builder view(@Nullable BannerView view); - + /** * Build a new {@link BannerInstructions} object. * From 95a8f92641e4f35658360d8ea309d2d41a3311e5 Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 14:55:49 -0800 Subject: [PATCH 19/20] improve test --- .../api/directions/v5/models/JunctionViewResponseTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java index 99782726f..729cd27e6 100644 --- a/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java +++ b/services-directions/src/test/java/com/mapbox/api/directions/v5/models/JunctionViewResponseTest.java @@ -32,7 +32,7 @@ public void testValuesFromJson() { BannerView bannerView = responseFromJson.view(); Assert.assertEquals(bannerView.text(), "CA01610_1_E"); - Assert.assertEquals(bannerView.type(), "fork"); + Assert.assertEquals(bannerView.type(), StepManeuver.FORK); Assert.assertEquals(bannerView.modifier(), "right"); Assert.assertEquals(responseFromJson.view().components().size(), 1); From b91fcafd1e7f8e79bb2e3384b5ed3620319baa4e Mon Sep 17 00:00:00 2001 From: Kyle Madsen <> Date: Wed, 8 Jan 2020 14:59:55 -0800 Subject: [PATCH 20/20] wrong version --- .../com/mapbox/api/directions/v5/models/BannerComponents.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java index 666569f37..19f26df8b 100644 --- a/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java +++ b/services-directions/src/main/java/com/mapbox/api/directions/v5/models/BannerComponents.java @@ -73,7 +73,7 @@ public abstract class BannerComponents extends DirectionsJsonObject /** * This view gives guidance through junctions and is used to complete maneuvers. * - * @since 3.0.0 + * @since 5.0.0 */ public static final String GUIDANCE_VIEW = "guidance-view";