Skip to content

Commit 5c34c75

Browse files
author
Łukasz Paczos
committed
exposed TollCollection#name
1 parent ba22dab commit 5c34c75

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Mapbox welcomes participation and contributions from everyone.
44

55
### main
6+
- Added `TollCollection#name` field which contains a name of the toll booth/gantry, when available. [#1432](https://github.com/mapbox/mapbox-java/pull/1432)
67

78
### v6.5.0-beta.4 - May 5, 2022
89
- Added `RestStop#name` field which contains a name of the service/rest area, when available. [#1428](https://github.com/mapbox/mapbox-java/pull/1428)

services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/TollCollection.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public abstract class TollCollection extends DirectionsJsonObject {
2727
@Nullable
2828
public abstract String type();
2929

30+
/**
31+
* The name of toll collection point. Optionally included if data is available.
32+
*/
33+
@Nullable
34+
public abstract String name();
35+
3036
/**
3137
* Create a new instance of this class by using the {@link Builder} class.
3238
*
@@ -82,6 +88,13 @@ public abstract static class Builder extends DirectionsJsonObject.Builder<Builde
8288
*/
8389
public abstract Builder type(@Nullable String type);
8490

91+
/**
92+
* The name of toll collection point. Optionally included if data is available.
93+
*
94+
* @param name toll collection name
95+
*/
96+
public abstract Builder name(@Nullable String name);
97+
8598
/**
8699
* Build a new {@link TollCollection} object.
87100
*

services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/StepIntersectionTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void testToFromJson1() {
4747
.geometryIndex(123)
4848
.isUrban(true)
4949
.restStop(RestStop.builder().type("rest_area").name("stop_name").build())
50-
.tollCollection(TollCollection.builder().type("toll_gantry").build())
50+
.tollCollection(TollCollection.builder().type("toll_gantry").name("toll_name").build())
5151
.adminIndex(2)
5252
.mapboxStreetsV8(MapboxStreetsV8.builder().roadClass("street").build())
5353
.tunnelName("tunnel_name")
@@ -140,12 +140,13 @@ public void testRestStop() {
140140
public void testTollCollection() {
141141
String stepIntersectionJsonString = "{"
142142
+ "\"location\": [ 13.426579, 52.508068 ],"
143-
+ "\"toll_collection\": { \"type\": \"toll_gantry\" }"
143+
+ "\"toll_collection\": { \"type\": \"toll_gantry\", \"name\": \"toll_name\" }"
144144
+ "}";
145145

146146
StepIntersection stepIntersection = StepIntersection.fromJson(stepIntersectionJsonString);
147147

148148
Assert.assertEquals("toll_gantry", stepIntersection.tollCollection().type());
149+
Assert.assertEquals("toll_name", stepIntersection.tollCollection().name());
149150
String jsonStr = stepIntersection.toJson();
150151
compareJson(stepIntersectionJsonString, jsonStr);
151152
}

0 commit comments

Comments
 (0)