-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Route options should be serialized/deserialized using backend names #895
Conversation
.requestUuid("uuid1") | ||
.build(); | ||
|
||
String jsonString = routeOptions.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@osana
Found it 🎉
Should be routeOptions.toJson()
instead of toString()
.
In any case, we should be careful because we can't compare json strings as we're doing here (compareJson
below), because the order in which the json fields are represented is taken into account in the assertion which doesn't mean that the JSON is incorrect.
I've also noticed a discrepancy in the coordinates
which we should fix 👀
Expected
"coordinates":[{"type":"Point","coordinates":[-3.707788,40.395039]},{"type":"Point","coordinates":[-3.712179,40.401819]}]
Actual
"coordinates":[[-3.707788,40.395039],[-3.712179,40.401819]]
@Guardiola31337 thank you for your 👀 . Please have a look. As per our conversation in slack - I think we should stick with "coordinates":[[-3.707788,40.395039],[-3.712179,40.401819]] format. Right now PointDeserializer is able to handle : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor nit picks.
@@ -214,4 +215,94 @@ public void toJson_fromJson() throws Exception { | |||
|
|||
assertEquals(routeOptions, routeOptionsFromJson); | |||
} | |||
|
|||
@Test | |||
public void test_fromJson() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT test
from test_fromJson
is redundant IMO
services-directions/src/test/java/com/mapbox/api/directions/v5/models/RouteOptionsTest.java
Show resolved
Hide resolved
|
||
@Test | ||
public void test_toJson() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT unnecessary empty line
"\"banner_instructions\": true," + | ||
"\"voice_units\": \"imperial\"," + | ||
"\"uuid\": \"uuid1\"}"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT unnecessary empty line
using the matching names from backend api
@Guardiola31337 I believe all NITs are fixe now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the comments @osana
closes #894
RouteOptions.test_toJson test is still failing com.google.gson.stream.MalformedJsonException
@Guardiola31337 There must be some typo... that I cannot see. Could you 👀 .