Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jul 10, 2019
2 parents 7ea75c8 + 0699d54 commit 3b2494a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/main/java/org/cactoos/io/TeeInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@

/**
* Stream that copies input to output.
* <b>WARNING:</b>
* This class closes {@link TeeInputStream#output}
* after {@link TeeInputStream#close()}.
*
* <p>There is no thread-safety guarantee.
*
Expand Down Expand Up @@ -94,7 +97,7 @@ public int available() throws IOException {
@Override
public void close() throws IOException {
this.input.close();
this.output.flush();
this.output.close();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/cactoos/io/TeeInputStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void copiesContentByteByByte() throws Exception {
}

@Test
public void leftInputUnclosed() {
public void leftInputClosed() {
try (StringWriterMock write = new StringWriterMock()) {
new LengthOf(
new TeeInput(
Expand All @@ -79,7 +79,7 @@ public void leftInputUnclosed() {
MatcherAssert.assertThat(
"Can't use output after usage from TeeInput",
write.isClosed(),
new IsEqual<>(false)
new IsEqual<>(true)
);
}
}
Expand Down

0 comments on commit 3b2494a

Please sign in to comment.