-
Notifications
You must be signed in to change notification settings - Fork 117
Fix static marker annotation url generation #479
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
Conversation
| public String getColor() { | ||
| return color; | ||
| if (color.isEmpty()) { | ||
| return EMPTY; |
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.
Why not just return null if a color isn't set?
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.
Same here.
| public String getLabel() { | ||
| return label; | ||
| if (label.isEmpty()) { | ||
| return EMPTY; |
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.
Why not just return null if a label isn't set?
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.
@cammace null is not valid because getLabel is called when parsing (String.format) and label is an optional param (note that -was removed from the default string because if the label was empty url was incorrect. A Null Object pattern could be implemented though.
BTW null is considered The worst mistake of computer science: Null References: The Billion Dollar Mistake 😉
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.
lol, I've read that interview 😄 . Sounds good.
| new StaticMarkerAnnotation.Builder().setName(Constants.PIN_SMALL).setLat(2.0).build(); | ||
| } | ||
|
|
||
| @Test(expected = ServicesException.class) |
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.
Should we be more explicit on which ServiceException we expect to occur here?
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.
IMO just testing that an exception is thrown when an url is not valid is 👌
If more explicitness needed, what about creating a new specific exception?
BTW, is that explicitness really needed in this case?
Fixes mapbox/mapbox-gl-native#9107
👀 @zugaldia @cammace