Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Apr 23, 2019
2 parents d70339d + f341664 commit b74f80c
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 90 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/cactoos/io/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@
* Input/Output.
*
* @since 0.1
* @todo #1033:30min Continue replacing usage of MatcherAssert.assertThat with
* Assertion from cactoos-matchers. Once there is no more usage of
* MatcherAssert.assertThat, add the signature of MatcherAssert.assertThat to
* forbidden-apis.txt
*/
package org.cactoos.io;
9 changes: 4 additions & 5 deletions src/test/java/org/cactoos/TextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import org.cactoos.text.NoNulls;
import org.cactoos.text.TextOf;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.TextHasString;
Expand Down Expand Up @@ -65,13 +64,13 @@ public void failForNullResult() {
@Test
public void okForNoNulls() {
final String message = "Hello";
MatcherAssert.assertThat(
"Can't work with null text",
new NoNulls(
new Assertion<>(
"Must work with NoNulls",
() -> new NoNulls(
new TextOf(message)
),
new TextHasString(message)
);
).affirm();
}

}
20 changes: 10 additions & 10 deletions src/test/java/org/cactoos/io/LSInputOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
*/
package org.cactoos.io;

import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;

/**
* Test case for {@link LSInputOf}.
Expand All @@ -38,41 +38,41 @@ public final class LSInputOfTest {

@Test
public void readsSimpleInput() {
MatcherAssert.assertThat(
new Assertion<>(
"Can't read simple input",
new LSInputOf(
() -> new LSInputOf(
new InputOf("hello, world!")
).getStringData(),
Matchers.endsWith("world!")
);
).affirm();
}

@Test
public void readsBiggerInput() {
final int size = 400_000;
MatcherAssert.assertThat(
new Assertion<>(
"Can't read bigger input",
new LSInputOf(
() -> new LSInputOf(
new InputOf(
new SlowInputStream(size)
)
).getStringData().length(),
Matchers.equalTo(size)
);
).affirm();
}

@Test
public void countsBytesInBiggerInput() {
final int size = 300_000;
MatcherAssert.assertThat(
new Assertion<>(
"Can't count bytes in a bigger input",
new LSInputOf(
() -> new LSInputOf(
new InputOf(
new SlowInputStream(size)
)
).getStringData().length(),
Matchers.equalTo(size)
);
).affirm();
}

}
Loading

1 comment on commit b74f80c

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on b74f80c Apr 23, 2019

Choose a reason for hiding this comment

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

Puzzle 1033-b5541bca discovered in src/main/java/org/cactoos/io/package-info.java and submitted as #1117. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.