-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add test to timezone.get_offset API call #261
Conversation
Signed-off-by: Drago8888 <rjmateus1985@gmail.com>
Signed-off-by: drago8888 <rjmateus1985@gmail.com>
Challenge from Ricardo Mateus |
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 adding those tests, your patch looks good to me! I only have some minor comments with suggestions for your consideration.
assertEquals(JsonNull.INSTANCE, | ||
((JsonParsingError) response.get("minion1").error().get()).getJson()); | ||
|
||
// Test for successful responses |
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.
I would suggest to test each case separately here, would you maybe want to move this second use case into a separate method?
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.
I agree with you, I think each case should be in a separated method and that was my first approach.
The reason behind my change of approach was to keep the consistency with the rest of the project test, with one test method per function with several scenarios.
However in this case following the right way instead of consistency seems not to bring any harm to the future of the project, therefore I will split the test into two as suggested.
TimezoneTest.class.getResourceAsStream( | ||
"/modules/timezone/null_response.json")); | ||
|
||
private static final String JSON_GETOFFESET_OK_RESPONSE = ClientUtils.streamToString( |
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.
There is a typo in this name, should be JSON_GETOFFSET_OK_RESPONSE
.
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.
Done. Thanks
|
||
private static final String JSON_GETOFFESET_OK_RESPONSE = ClientUtils.streamToString( | ||
TimezoneTest.class.getResourceAsStream( | ||
"/modules/timezone/getOffset_ok.json")); |
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.
May I suggest to rename that file in order to avoid mixing underscore with camel case notations to get_offset_ok.json
?
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.
done. Thanks
Signed-off-by: drago8888 <rjmateus1985@gmail.com>
Signed-off-by: drago8888 <rjmateus1985@gmail.com>
Signed-off-by: drago8888 <rjmateus1985@gmail.com>
Signed-off-by: Drago8888 rjmateus1985@gmail.com