Skip to content

Commit

Permalink
add etc2
Browse files Browse the repository at this point in the history
dzinad committed Nov 13, 2023
1 parent ca820fb commit 24ce7b2
Showing 4 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ Mapbox welcomes participation and contributions from everyone.

### main

- Added `DirectionsCriteria#PAYMENT_METHOD_ETC2` option to pass as `RouteOptions#computeTollCosts` and to receive in `IntersectionsLanes#paymentMethods`.

### v6.14.0 - October 26, 2023

- Added `LegAnnotation#freeflowSpeed` and `LegAnnotation#currentSpeed`. To receive these annotations, pass `DirectionsCriteria.ANNOTATION_FREEFLOW_SPEED` and `DirectionsCriteria.ANNOTATION_CURRENT_SPEED` in the request in the "annotations" parameter.
Original file line number Diff line number Diff line change
@@ -338,6 +338,15 @@ public final class DirectionsCriteria {
@SuppressWarnings("checkstyle:javadocvariable")
public static final String PAYMENT_METHOD_ETC = "etc";

/*
* A ETC 2.0 transponder.
* NOTE: If the specified `payment_methods` parameter includes `etc2`,
* `etc` lane will be validated and activated.
* This is because ETC2 user can pass through ETC tollbooths.
*/
@SuppressWarnings("checkstyle:javadocvariable")
public static final String PAYMENT_METHOD_ETC2 = "etc2";

/*
* A transponder only used for several specific roads in Japan.
*/
@@ -668,6 +677,7 @@ private DirectionsCriteria() {
PAYMENT_METHOD_VIDEO,
PAYMENT_METHOD_CRYPTOCURRENCIES,
PAYMENT_METHOD_APP,
PAYMENT_METHOD_ETC2,
})
public @interface PaymentMethodsCriteria {
}
Original file line number Diff line number Diff line change
@@ -88,4 +88,18 @@ public void testFromJson_etcAndGeneralPayment() {

assertEquals(intersectionLanes, intersectionLanesFromJson);
}

@Test
public void testFromJson_etc2Payment() {
IntersectionLanes intersectionLanes = IntersectionLanes.builder()
.paymentMethods(Arrays.asList(
DirectionsCriteria.PAYMENT_METHOD_ETC2
))
.build();

String jsonString = "{\"payment_methods\": [\"etc2\"]}";
IntersectionLanes intersectionLanesFromJson = IntersectionLanes.fromJson(jsonString);

assertEquals(intersectionLanes, intersectionLanesFromJson);
}
}
Original file line number Diff line number Diff line change
@@ -1037,6 +1037,17 @@ public void etcPaymentMethod() {
assertContains(query, "payment_methods=etc");
}

@Test
public void etc2PaymentMethod() {
RouteOptions routeOptions = routeOptions().toBuilder()
.paymentMethodsList(Arrays.asList(DirectionsCriteria.PAYMENT_METHOD_ETC2))
.build();
String query = routeOptions.toUrl("test").getQuery();

assertEquals("etc2", routeOptions.paymentMethods());
assertContains(query, "payment_methods=etc2");
}

@Test
public void generalAndEtcPaymentsMethod() {
List<String> paymentMethods = Arrays.asList(

0 comments on commit 24ce7b2

Please sign in to comment.