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

(#80) Read from streams in tests without closing #88

Merged
merged 1 commit into from
Jun 18, 2019

Conversation

victornoel
Copy link
Contributor

This is for #80:

  • introduced an abstraction to read from a stream without closing it
  • use it to actually test that what is read is correct in the various tests

@0crat 0crat added the scope label Jun 2, 2019
@0crat
Copy link
Collaborator

0crat commented Jun 2, 2019

Job #88 is now in scope, role is REV

@codecov-io
Copy link

codecov-io commented Jun 2, 2019

Codecov Report

Merging #88 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #88   +/-   ##
=========================================
  Coverage     95.02%   95.02%           
  Complexity       74       74           
=========================================
  Files            19       19           
  Lines           201      201           
  Branches         13       13           
=========================================
  Hits            191      191           
  Misses            7        7           
  Partials          3        3
Impacted Files Coverage Δ Complexity Δ
...ava/org/cactoos/http/io/AutoClosedInputStream.java 81.25% <0%> (ø) 3% <0%> (ø) ⬇️

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 10e6bf4...19720b8. Read the comment docs.

@0crat
Copy link
Collaborator

0crat commented Jun 2, 2019

This pull request #88 is assigned to @vzurauskas/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @llorllale/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer; there will be no monetary reward for this job

@victornoel
Copy link
Contributor Author

@vzurauskas ping

Copy link
Contributor

@vzurauskas vzurauskas left a comment

Choose a reason for hiding this comment

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

@victornoel Review done. Sorry for the delay.

*
* <p>There is no thread-safety guarantee.
*
* @since 0.1
Copy link
Contributor

Choose a reason for hiding this comment

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

@victornoel Current version is 0.0.1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vzurauskas yes, it was already released, so I can't use it with the since tag. Because I don't know what is going to be the next version, I used 0.1 since most of the cactoos artefacts were using that kind of versioning.

Let's ask @llorllale what he thinks.

I personally believe this tag is useless, see yegor256/qulice#1036 for a discussion on this :)

public final class ReadBytes implements Bytes {

/**
* Scalar.
Copy link
Contributor

Choose a reason for hiding this comment

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

@victornoel It's clear from the name of the variable and also from its type that this is a scalar. Consider adding something useful to the description, for instance what this scalar represents.

new TextOf(
new ReadBytes(new AutoClosedInputStream(closeable))
),
new TextIs("")
Copy link
Contributor

Choose a reason for hiding this comment

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

@victornoel Does it matter for this test whether Text of DeadInputStream is ""? The test is supposed to assert that the stream is closed after all bytes are read, which is the next assertion. Here I would just write something like new ReadBytes(new AutoClosedInputStream(closeable)).asBytes().

*
* @since 0.1
*/
public final class ReadBytes implements Bytes {
Copy link
Contributor

Choose a reason for hiding this comment

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

@victornoel Couldn't BytesOf from cactoos be used instead of this new class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vzurauskas nope, that was the purpose of the todo solved here: BytesOf has the problem of closing the stream after reading it. I will update the javadoc and add a test to enforce this behaviour!

@victornoel victornoel force-pushed the 80-read-stream-in-test-no-close branch from 8059e70 to a65d7b4 Compare June 16, 2019 09:15
@victornoel
Copy link
Contributor Author

@vzurauskas I've answered your comments and committed changes

Copy link
Contributor

@vzurauskas vzurauskas left a comment

Choose a reason for hiding this comment

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

@llorllale Looks good, but note the question about the @since version.

EDIT: Oh, except that the build is failing for some reason. @victornoel

@llorllale
Copy link
Collaborator

@victornoel try rebasing on master

@victornoel victornoel force-pushed the 80-read-stream-in-test-no-close branch from a65d7b4 to 19720b8 Compare June 17, 2019 19:54
@victornoel
Copy link
Contributor Author

@vzurauskas @llorllale it's fixed normally, but please read it again because I had forgotten some classes in my last push apparently

@vzurauskas
Copy link
Contributor

@llorllale Looks good.

@llorllale
Copy link
Collaborator

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Jun 18, 2019

@rultor merge

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

@rultor rultor merged commit 19720b8 into yegor256:master Jun 18, 2019
@rultor
Copy link
Collaborator

rultor commented Jun 18, 2019

@rultor merge

@llorllale Done! FYI, the full log is here (took me 19min)

@0crat
Copy link
Collaborator

0crat commented Jun 19, 2019

@sereshqua/z please review this job completed by @vzurauskas/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 Jun 19, 2019
@0crat
Copy link
Collaborator

0crat commented Jun 19, 2019

Code review was too long (16 days), architects (@llorllale) were penalized, see §55

@0crat
Copy link
Collaborator

0crat commented Jun 19, 2019

The job #88 is now out of scope

@0crat
Copy link
Collaborator

0crat commented Jun 19, 2019

Payment to ARC for a closed pull request, as in §28: +10 point(s) just awarded to @llorllale/z

@sereshqua
Copy link

@0crat quality good

@0crat
Copy link
Collaborator

0crat commented Jun 19, 2019

Quality review completed: +4 point(s) just awarded to @sereshqua/z

@0crat
Copy link
Collaborator

0crat commented Jun 19, 2019

Order was finished, quality is "good": +20 point(s) just awarded to @vzurauskas/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.

8 participants