-
Notifications
You must be signed in to change notification settings - Fork 319
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
Validate route profile passed into RouteViewModel #829
Conversation
9a418c5
to
8ba0179
Compare
*/ | ||
public static boolean isValidRouteProfile(String routeProfile) { | ||
return !TextUtils.isEmpty(routeProfile) | ||
&& routeProfile.contentEquals(DirectionsCriteria.PROFILE_DRIVING_TRAFFIC) |
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.
What about extracting the valid profiles into a collection and query only once (instead of 4 as is right now)? Does that make sense?
|
||
assertTrue(isValidProfile); | ||
} | ||
|
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.
It'd be great to add tests around the other valid profiles (i.e. PROFILE_DRIVING
, PROFILE_CYCLING
and PROFILE_WALKING
).
8ba0179
to
307bcf5
Compare
f861a64
to
3e7c345
Compare
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.
🚀
3e7c345
to
9b9b3e2
Compare
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.
Currently, we would use whatever profile a user sets, breaking the route requests.
Found this because we were defaulting the profile to
"1"
in the settings XML.