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

AbstractHmBody doesn't allow to use different matchers for text bodies #813

Merged
merged 3 commits into from
Mar 5, 2018

Conversation

t-izbassar
Copy link
Contributor

Fix for #794.

I've added AbstractHmTextBody matcher, that converts body contents to String and use that to match the contents with provided matcher. Added text body matchers for Request and Response with relevant test cases.

However, there still not covered descriptions of the fails and describeMismatchSafely is not implemented. Left puzzle to address this issue.

This PR partially solves original issue. Left puzzle to address what was left (converting AbstractHmBody to AbstractHmBytesBody) as those are beyond 30 mins mark.

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

Job #813 is now in scope, role is REV

@codecov-io
Copy link

codecov-io commented Feb 28, 2018

Codecov Report

Merging #813 into master will increase coverage by 0.32%.
The diff coverage is 84.84%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #813      +/-   ##
============================================
+ Coverage     76.54%   76.87%   +0.32%     
- Complexity      956      971      +15     
============================================
  Files           215      219       +4     
  Lines          4567     4610      +43     
  Branches        366      370       +4     
============================================
+ Hits           3496     3544      +48     
+ Misses          918      910       -8     
- Partials        153      156       +3
Impacted Files Coverage Δ Complexity Δ
...java/org/takes/facets/hamcrest/AbstractHmBody.java 75% <ø> (ø) 5 <0> (ø) ⬇️
...n/java/org/takes/facets/hamcrest/HmRsTextBody.java 100% <100%> (ø) 4 <4> (?)
...n/java/org/takes/facets/hamcrest/HmRqTextBody.java 100% <100%> (ø) 4 <4> (?)
.../org/takes/facets/hamcrest/AbstractHmTextBody.java 73.68% <73.68%> (ø) 4 <4> (?)
src/main/java/org/takes/tk/TkRedirect.java 60% <0%> (-21.82%) 2% <0%> (ø)
...in/java/org/takes/facets/auth/social/PsGithub.java 87.23% <0%> (ø) 5% <0%> (-1%) ⬇️
src/main/java/org/takes/tk/TkSmartRedirect.java 85.18% <0%> (ø) 3% <0%> (?)
... and 2 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 277f0a8...f6c48c0. Read the comment docs.

@0crat
Copy link
Collaborator

0crat commented Mar 1, 2018

This pull request #813 is assigned to @g4s8/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.

@t-izbassar
Copy link
Contributor Author

@g4s8 ping

Copy link
Contributor

@g4s8 g4s8 left a comment

Choose a reason for hiding this comment

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

@t-izbassar looks good, just few comments

* @param expected String to test against
*/
public HmRqTextBody(final String expected) {
this(Matchers.containsString(expected));
Copy link
Contributor

Choose a reason for hiding this comment

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

@t-izbassar I think it's not clear, because default matcher in Hamcrest library usually is Matchers.equalTo(), so as a user of HmRqTextBody I'd expect that body is equal to constructor parameter string


@Override
public final void describeTo(final Description description) {
description.appendDescriptionOf(this.body);
Copy link
Contributor

Choose a reason for hiding this comment

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

@t-izbassar it will be not really informative, it should include not only expected result, but also actual value and some text description. Please see how it is implemented in AbstractHmHeader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@g4s8 updated puzzle description to cover that issue.

public void testsBodyValueContainsText() {
MatcherAssert.assertThat(
new RsWithBody("<html><h1>Hello</h1></html>"),
new HmRsTextBody("<h1>Hello</h1>")
Copy link
Contributor

Choose a reason for hiding this comment

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

@t-izbassar this test is not so obvious, please look at previous comment about default matcher in constructor

@t-izbassar
Copy link
Contributor Author

@g4s8 done.

@g4s8
Copy link
Contributor

g4s8 commented Mar 3, 2018

@yegor256 I accept

@t-izbassar
Copy link
Contributor Author

@yegor256 can you merge this one?

@yegor256
Copy link
Owner

yegor256 commented Mar 5, 2018

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Mar 5, 2018

@rultor merge

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

@rultor rultor merged commit f6c48c0 into yegor256:master Mar 5, 2018
@rultor
Copy link
Collaborator

rultor commented Mar 5, 2018

@rultor merge

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

@0crat
Copy link
Collaborator

0crat commented Mar 5, 2018

@elenavolokhova/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

@elenavolokhova
Copy link

@0crat quality good

@0crat
Copy link
Collaborator

0crat commented Mar 6, 2018

@0crat quality good (here)

@elenavolokhova 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 Mar 6, 2018

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

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

0crat commented Mar 6, 2018

Order was finished, quality was "good": +20 points just awarded to @g4s8/z

@0crat
Copy link
Collaborator

0crat commented Mar 6, 2018

@0crat quality good (here)

@elenavolokhova The job #813 is now out of scope

@0crat
Copy link
Collaborator

0crat commented Mar 6, 2018

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

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.

None yet

7 participants