@@ -59,6 +59,7 @@ public void testToFromJson1() {
5959 .junction (Junction .builder ().name ("jct_name" ).build ())
6060 .interchange (Interchange .builder ().name ("ic_name" ).build ())
6161 .mergingArea (MergingArea .builder ().type (MergingArea .TYPE_FROM_LEFT ).build ())
62+ .duration (12.34 )
6263 .build ();
6364
6465 String jsonString = intersection .toJson ();
@@ -101,7 +102,8 @@ public void testFromJson() {
101102 + "\" traffic_signal\" : true,"
102103 + "\" stop_sign\" : true,"
103104 + "\" merging_area\" : {\" type\" : \" from_right\" },"
104- + "\" yield_sign\" : true"
105+ + "\" yield_sign\" : true,"
106+ + "\" duration\" : 12.34"
105107 + "}" ;
106108
107109 StepIntersection stepIntersection = StepIntersection .fromJson (stepIntersectionJsonString );
@@ -114,6 +116,7 @@ public void testFromJson() {
114116 assertTrue (stepIntersection .stopSign ());
115117 assertTrue (stepIntersection .yieldSign ());
116118 assertEquals (MergingArea .builder ().type (MergingArea .TYPE_FROM_RIGHT ).build (), stepIntersection .mergingArea ());
119+ assertEquals (12.34 , stepIntersection .duration (), 0.0001 );
117120
118121 Point location = stepIntersection .location ();
119122 assertEquals (13.426579 , location .longitude (), 0.0001 );
@@ -222,6 +225,33 @@ public void testNullInterchange() {
222225 compareJson (stepIntersectionJsonString , jsonStr );
223226 }
224227
228+ @ Test
229+ public void testDuration () {
230+ String stepIntersectionJsonString = "{"
231+ + "\" location\" : [ 13.426579, 52.508068 ],"
232+ + "\" duration\" : 12.34"
233+ + "}" ;
234+
235+ StepIntersection stepIntersection = StepIntersection .fromJson (stepIntersectionJsonString );
236+
237+ Assert .assertEquals (12.34 , stepIntersection .duration (), 0.0001 );
238+ String jsonStr = stepIntersection .toJson ();
239+ compareJson (stepIntersectionJsonString , jsonStr );
240+ }
241+
242+ @ Test
243+ public void testNullDuration () {
244+ String stepIntersectionJsonString = "{"
245+ + "\" location\" : [ 13.426579, 52.508068 ]"
246+ + "}" ;
247+
248+ StepIntersection stepIntersection = StepIntersection .fromJson (stepIntersectionJsonString );
249+
250+ Assert .assertNull (stepIntersection .duration ());
251+ String jsonStr = stepIntersection .toJson ();
252+ compareJson (stepIntersectionJsonString , jsonStr );
253+ }
254+
225255 @ Test
226256 public void testMergingArea () {
227257 String stepIntersectionJsonString = "{"
0 commit comments