Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jepp3
Copy link
Member

@jepp3 jepp3 commented Jul 6, 2019

Notes

  1. 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.

  2. 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.

@codecov-io
Copy link

codecov-io commented Jul 6, 2019

Codecov Report

Merging #53 into master will increase coverage by 8.09%.
The diff coverage is 100%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
impl/src/main/java/slack/SlackClientImpl.java 100% <100%> (ø) 10 <10> (?)
impl/src/main/java/slack/SlackResourceImpl.java 100% <100%> (+71.42%) 16 <5> (+6) ⬆️
impl/src/main/java/slack/SlackConfig.java 100% <0%> (+54.54%) 7% <0%> (+4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7f358b...edd2b0a. Read the comment docs.


@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";
Copy link
Contributor

@flowertwig flowertwig Jul 8, 2019

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.

Copy link
Contributor

@flowertwig flowertwig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

impl/src/test/java/slack/SlackClientImplTest.java Outdated Show resolved Hide resolved
impl/src/test/java/slack/SlackResourceImplTest.java Outdated Show resolved Hide resolved
impl/src/test/java/slack/SlackResourceImplTest.java Outdated Show resolved Hide resolved
impl/src/test/java/slack/SlackResourceImplTest.java Outdated Show resolved Hide resolved
impl/src/test/java/slack/SlackResourceImplTest.java Outdated Show resolved Hide resolved
@jepp3 jepp3 requested a review from flowertwig July 8, 2019 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants