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

#630 ReaderOf test class is incomplete #676

Merged
merged 6 commits into from
Feb 26, 2018
Merged

#630 ReaderOf test class is incomplete #676

merged 6 commits into from
Feb 26, 2018

Conversation

proshin-roman
Copy link
Contributor

@proshin-roman proshin-roman commented Feb 18, 2018

Pull request for the issue #630. It increases test coverage of ReaderOf class up to 100%. All ctors are covered by successful tests now. No other changes.

@0crat 0crat added the scope label Feb 18, 2018
@0crat
Copy link
Collaborator

0crat commented Feb 18, 2018

Job #676 is now in scope, role is REV

@0crat
Copy link
Collaborator

0crat commented Feb 18, 2018

This pull request #676 is assigned to @amihaiemil/z, here is why. The budget is 15 minutes, see §4. Please, read §27 and when you decide to accept the changes, inform @yegor256/z (the architect) right in this ticket. If you decide that this PR should not be accepted ever, also inform the architect.

@codecov-io
Copy link

codecov-io commented Feb 18, 2018

Codecov Report

Merging #676 into master will increase coverage by 3.57%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #676      +/-   ##
===========================================
+ Coverage     70.03%   73.6%   +3.57%     
- Complexity     1005    1088      +83     
===========================================
  Files           215     222       +7     
  Lines          3304    3361      +57     
  Branches        190     190              
===========================================
+ Hits           2314    2474     +160     
+ Misses          943     841     -102     
+ Partials         47      46       -1
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/cactoos/scalar/ItemAt.java 84.44% <0%> (-0.34%) 19% <0%> (+1%)
src/main/java/org/cactoos/scalar/Folded.java 100% <0%> (ø) 4% <0%> (ø) ⬇️
src/main/java/org/cactoos/scalar/HighestOf.java 100% <0%> (ø) 7% <0%> (?)
src/main/java/org/cactoos/scalar/LowestOf.java 100% <0%> (ø) 7% <0%> (?)
src/main/java/org/cactoos/scalar/SumOfScalar.java 100% <0%> (ø) 3% <0%> (?)
...main/java/org/cactoos/scalar/SumOfFloatScalar.java 100% <0%> (ø) 2% <0%> (?)
...c/main/java/org/cactoos/scalar/SumOfIntScalar.java 100% <0%> (ø) 2% <0%> (?)
...ain/java/org/cactoos/scalar/SumOfDoubleScalar.java 100% <0%> (ø) 2% <0%> (?)
.../main/java/org/cactoos/scalar/SumOfLongScalar.java 100% <0%> (ø) 2% <0%> (?)
src/main/java/org/cactoos/list/ListEnvelope.java 93.75% <0%> (+1.44%) 13% <0%> (+3%) ⬆️
... and 9 more

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 b2927eb...747f95d. Read the comment docs.

Copy link

@amihaiemil amihaiemil left a comment

Choose a reason for hiding this comment

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

@proshin-roman Looks good overall, but I had a few comments. And please, link the parent issue in the PR's description.

@@ -40,18 +41,317 @@
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
@SuppressWarnings({"PMD.TooManyMethods", "PMD.AvoidDuplicateLiterals"})

Choose a reason for hiding this comment

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

@proshin-roman Can you please avoid the duplicate literals? As I see, it's mostly the 'abc' string. Please write different chars for them to avoid this error.

In the tests where the same String appears twice, I would declare it in a final local variable.

Copy link
Contributor Author

@proshin-roman proshin-roman Feb 20, 2018

Choose a reason for hiding this comment

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

@amihaiemil I've extracted test content into a final static (!) field and got rid of other string constants.

MatcherAssert.assertThat(
"Can't read content",
new InputOf(new ReaderOf('a', 'b', 'c')),
new InputHasContent("abc")
Copy link

@amihaiemil amihaiemil Feb 20, 2018

Choose a reason for hiding this comment

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

@proshin-roman Is it not possible to use Hamcrest matchers here? It seems strange to me, to use matchers from cactoos itself -- what if the matcher will have a bug in the future? Tests will break for that reason and it will be misleading.

I would use trusted Hamcrest matchers, even if you have to call asString() or something, on InputOf

Furthermore, it would be nice if we could test ReaderOf without having to wrap it inside InputOf -- what if the test fails because there is a bug in InputOf and ReaderOf is actually fine? Would that be too complicated?

Copy link
Contributor Author

@proshin-roman proshin-roman Feb 20, 2018

Choose a reason for hiding this comment

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

@amihaiemil I've tried to do that using one private method that does the assertion.

),
new InputHasContent("Hello, товарищ!")
);
}

Choose a reason for hiding this comment

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

@proshin-roman Can you add a few tests with empty and null content? What happens if ReaderOf tries to read from an empty/null source?

Copy link
Contributor Author

@proshin-roman proshin-roman Feb 20, 2018

Choose a reason for hiding this comment

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

@amihaiemil I've added tests for null and empty string.

),
new InputHasContent("Hello, товарищ!")
);
}
}
Copy link

@amihaiemil amihaiemil Feb 20, 2018

Choose a reason for hiding this comment

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

@proshin-roman Can you also add a test for german characters? It is quite a spoken language, so we should be able to read german diacritics. The german diacritics are: äÄ üÜ öÖ and ß

Copy link
Contributor Author

@proshin-roman proshin-roman Feb 20, 2018

Choose a reason for hiding this comment

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

@amihaiemil That was done too.

@amihaiemil
Copy link

amihaiemil commented Feb 21, 2018

@proshin-roman Looks ok to me, but I believe the architect will complain about that final static CONTENT, since it's a shared resource between tests. Here is the article about it (I personally don't agree with it, it seems overengineering).

Let's see what he says though :)

@amihaiemil
Copy link

@rultor Good to merge

@rultor
Copy link
Collaborator

rultor commented Feb 21, 2018

@rultor Good to merge

@amihaiemil Thanks for your request. @yegor256 Please confirm this.

@amihaiemil
Copy link

@proshin-roman And please, edit all your comments (including review comments) and address them to me (they should start with @amihaiemil) -- the QA will complain about this stuff :D

@proshin-roman
Copy link
Contributor Author

proshin-roman commented Feb 21, 2018

@amihaiemil Exactly! I know about "no static" rule, but I believe it's ok for this test as it's really same content for all the test cases. Theoretically, we can avoid that by using something like <current string> + <index> so that technically we have different strings, but it doesn't change the thing.

@amihaiemil
Copy link

@yegor256 ping

* Test content for all the tests in this class.
*/
private static final String CONTENT =
"Hello, товарищ äÄ üÜ öÖ and ß";
Copy link
Owner

Choose a reason for hiding this comment

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

@yegor256
Copy link
Owner

@proshin-roman see above

@proshin-roman
Copy link
Contributor Author

@yegor256 @amihaiemil I've updated pull request: no static fields now. Please review it again.

@0crat
Copy link
Collaborator

0crat commented Feb 23, 2018

@amihaiemil/z this job was assigned to you 5 days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please.

Copy link

@amihaiemil amihaiemil left a comment

Choose a reason for hiding this comment

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

@proshin-roman looks much better now :)

@amihaiemil
Copy link

@yegor256 we can merge this now, I think

@yegor256
Copy link
Owner

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Feb 26, 2018

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 747f95d into yegor256:master Feb 26, 2018
@rultor
Copy link
Collaborator

rultor commented Feb 26, 2018

@rultor merge

@yegor256 Done! FYI, the full log is here (took me 9min)

@0crat
Copy link
Collaborator

0crat commented Feb 26, 2018

@ypshenychka/z please review this job, as in §30; the job will be fully closed and all payments will be made when the quality review is completed

@proshin-roman proshin-roman deleted the bugfix-630 branch February 26, 2018 06:05
@0crat
Copy link
Collaborator

0crat commented Feb 26, 2018

@amihaiemil/z this job was assigned to you 8 days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please.

@ypshenychka
Copy link

@0crat quality good

@0crat
Copy link
Collaborator

0crat commented Feb 26, 2018

QA review completed: +8 points just awarded to @ypshenychka/z, total is +694

@0crat
Copy link
Collaborator

0crat commented Feb 26, 2018

Order was finished, quality was "good": +20 points just awarded to @amihaiemil/z, total is +980

@0crat
Copy link
Collaborator

0crat commented Feb 26, 2018

@0crat quality good (here)

@ypshenychka You can't do that, unless you have one of these roles: ARC, PO. Your current roles are: QA.

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

This pull request #676 is assigned to @neonailol/z, here is why. The budget is 15 minutes, see §4. Please, read §27 and when you decide to accept the changes, inform @yegor256/z (the architect) right in this ticket. If you decide that this PR should not be accepted ever, also inform the architect.

@neonailol
Copy link
Contributor

@0crat status

@0crat
Copy link
Collaborator

0crat commented Mar 2, 2018

Are you speaking to me or about me here. You must always start your message with my name if you want to address it to me, see §1.

@neonailol
Copy link
Contributor

@0crat status

@0crat
Copy link
Collaborator

0crat commented Mar 5, 2018

@0crat status (here)

@neonailol This is what I know about this job, as in §32:

@neonailol
Copy link
Contributor

@yegor256 this job was assigned to me by mistake

@yegor256
Copy link
Owner

yegor256 commented Mar 5, 2018

@0crat refuse

@yegor256
Copy link
Owner

yegor256 commented Mar 5, 2018

@0crat out

@0crat 0crat removed the scope label Mar 5, 2018
@0crat
Copy link
Collaborator

0crat commented Mar 5, 2018

@0crat refuse (here)

@yegor256 The user @neonailol/z resigned from #676, please stop working. Reason for job resignation: Order was cancelled

@0crat
Copy link
Collaborator

0crat commented Mar 5, 2018

@0crat out (here)

@yegor256 The job #676 is now out of scope

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.

8 participants