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

#721: Add matcher for TeeInput class #731

Merged
merged 2 commits into from
Mar 20, 2018
Merged

#721: Add matcher for TeeInput class #731

merged 2 commits into from
Mar 20, 2018

Conversation

proshin-roman
Copy link
Contributor

@proshin-roman proshin-roman commented Mar 10, 2018

It is for issue #721: adds a new matcher that checks result of TeeInput class: compares both TeeInput's results (direct and copied) to the expected value. As well this new matcher has been applied to existing tests of TeeInput class.

@0crat 0crat added the scope label Mar 10, 2018
@0crat
Copy link
Collaborator

0crat commented Mar 10, 2018

Job #731 is now in scope, role is REV

@0crat
Copy link
Collaborator

0crat commented Mar 10, 2018

This pull request #731 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.

@codecov-io
Copy link

codecov-io commented Mar 10, 2018

Codecov Report

Merging #731 into master will increase coverage by 0.83%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #731      +/-   ##
============================================
+ Coverage     77.03%   77.87%   +0.83%     
- Complexity     1147     1165      +18     
============================================
  Files           222      223       +1     
  Lines          3349     3367      +18     
  Branches        191      191              
============================================
+ Hits           2580     2622      +42     
+ Misses          722      698      -24     
  Partials         47       47
Impacted Files Coverage Δ Complexity Δ
...n/java/org/cactoos/matchers/TeeInputHasResult.java 100% <100%> (ø) 6 <6> (?)
src/main/java/org/cactoos/io/TeeInput.java 16.21% <0%> (+1.35%) 11% <0%> (+1%) ⬆️
src/main/java/org/cactoos/io/OutputTo.java 65.71% <0%> (+11.42%) 11% <0%> (+2%) ⬆️
...main/java/org/cactoos/io/WriterAsOutputStream.java 80% <0%> (+16%) 10% <0%> (+4%) ⬆️
src/main/java/org/cactoos/io/TeeOutput.java 100% <0%> (+62.5%) 7% <0%> (+5%) ⬆️

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 72597f9...7860883. Read the comment docs.

@proshin-roman
Copy link
Contributor Author

@neonailol ping :)

*/
public TeeInputHasResult(
final Text expected,
final Text copied) {
Copy link
Contributor

Choose a reason for hiding this comment

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

formatting is not consistent

*/
public TeeInputHasResult(
final String expected,
final Text copied) {
Copy link
Contributor

Choose a reason for hiding this comment

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

formatting is not consistent

public boolean matchesSafely(final TeeInput item) {
this.actual = new ComparableText(new TextOf(item));
return
this.expected.compareTo(this.actual) == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use org.cactoos.scalar.Equals here

new FormattedText(
TeeInputHasResult.DESCRIPTION,
new UncheckedText(this.expected).asString(),
new UncheckedText(this.expected).asString()
Copy link
Contributor

@neonailol neonailol Mar 12, 2018

Choose a reason for hiding this comment

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

Duplicated line new UncheckedText(this.expected).asString() possible something other should be here

@proshin-roman
Copy link
Contributor Author

@neonailol Thanks for your comments - they were useful. I've fixed all of them except a comment about inconsistent formatting: I've changed another ctor where the closing bracket ) is on a new line. Please review the pull request again.

@neonailol
Copy link
Contributor

@proshin-roman thanks looks good now

@neonailol
Copy link
Contributor

@rultor good to merge

@rultor
Copy link
Collaborator

rultor commented Mar 13, 2018

@rultor good to merge

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

@proshin-roman
Copy link
Contributor Author

@yegor256 ping

@neonailol
Copy link
Contributor

@yegor256 Please confirm this.

@yegor256
Copy link
Owner

@proshin-roman to be honest, I don't like this at all. Why do we need this matcher? What's wrong with existing assertThat two times? It looks like something very artificial and super-specific for one particular use case.

@proshin-roman
Copy link
Contributor Author

@yegor256 well, TeeInput class has a lot of ctors (about 50) and all of them should be covered by tests (there is a ticket for that). It means double-assert will be copy-pasted for all these test cases. Another problem of double-assert: you have to trigger them in exact order otherwise they fail. This new matcher allows to avoid both of these problems. Finally, it's a goal of the ticket - you can decline this feature at all as the Arch of the project. And then I will have a reason to use double-assert in my other pull request.

@0crat
Copy link
Collaborator

0crat commented Mar 18, 2018

@neonailol/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.

@yegor256
Copy link
Owner

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Mar 20, 2018

@rultor merge

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

@proshin-roman
Copy link
Contributor Author

@yegor256 damn, the pull request is going to be merged but the ticket is already resigned from me. I would be very happy if you assign it back to me, please :)

@rultor rultor merged commit 7860883 into yegor256:master Mar 20, 2018
@rultor
Copy link
Collaborator

rultor commented Mar 20, 2018

@rultor merge

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

@0crat
Copy link
Collaborator

0crat commented Mar 20, 2018

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

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

0crat commented Mar 20, 2018

The job #731 is now out of scope

@0crat
Copy link
Collaborator

0crat commented Mar 20, 2018

Payment to ARC for a closed pull request, as in §28: +10 points just awarded to @yegor256/z

@elenavolokhova
Copy link

@neonailol According to our Policy:

The code reviewer found at least three problems in the code

Only two issues were fixed and actually improved the code quality in this case.
Please, confirm that you will try to find at least three problems next time.

@neonailol
Copy link
Contributor

@elenavolokhova i confirm

@elenavolokhova
Copy link

@0crat quality acceptable

@0crat
Copy link
Collaborator

0crat commented Mar 21, 2018

Order was finished, quality is "acceptable": +15 points just awarded to @neonailol/z

@0crat
Copy link
Collaborator

0crat commented Mar 21, 2018

Quality review completed: +8 points just awarded to @elenavolokhova/z

@proshin-roman proshin-roman deleted the 721 branch April 24, 2018 16:52
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.

7 participants