-
Notifications
You must be signed in to change notification settings - Fork 3
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
added slack client and made the code more testable. Improved coverage #53
base: master
Are you sure you want to change the base?
Conversation
… to 100% in slackResource
Codecov Report
@@ Coverage Diff @@
## master #53 +/- ##
============================================
+ Coverage 78.75% 86.84% +8.09%
- Complexity 228 248 +20
============================================
Files 32 33 +1
Lines 640 646 +6
Branches 15 15
============================================
+ Hits 504 561 +57
+ Misses 124 73 -51
Partials 12 12
Continue to review full report at Codecov.
|
|
||
@Singleton | ||
public class SlackResourceImpl implements SlackResource { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(SlackResourceImpl.class); | ||
private final Slack slack; | ||
public static final String USER_EMAIL_FROM_SLACK_IS_NULL_AND_MIGHT_BE_DUE_TO_MISSING_SCOPE_USERS_READ_EMAIL = "User email from slack is null and might be due to missing scope users:read.email"; |
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 think we should name the constants to convey the gist of the error rather than the exact words.
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.
Nice!
Notes
Added a slack client that wraps the jslack client with obserables. This it to reduce duplication of code and make the code more readable. Note: The logic in slackResourceImpl has not been changed. Just switched to the new client.
improved the coverage to 100% in both SlackResourceImpl and SlackClientImpl. That increases the coverage to 87% for the repository.
Question:
This is one way to solve it, but there might be a smarter way?
Further work:
jSlack uses OkHttp which should have pooled connections but we still block on the rxnetty eventloop waiting for an result. Perhaps use Schedulers.io() (unbounded) or a dedicated threadpool?
Implement all methods and move out to a reusable lib, when we think its good enough.