Search in sources :

Example 1 with Endless

use of org.cactoos.iterable.Endless in project cactoos by yegor256.

the class BytesOfTest method readsLargeInMemoryContent.

@Test
void readsLargeInMemoryContent() throws Exception {
    final int multiplier = 5_000;
    final String body = "1234567890";
    new Assertion<>("must read large content from in-memory Input", new BytesOf(new InputOf(new Concatenated(new HeadOf<>(multiplier, new Endless<>(new TextOf(body)))))).asBytes().length, new IsEqual<>(body.length() * multiplier)).affirm();
}
Also used : Endless(org.cactoos.iterable.Endless) Concatenated(org.cactoos.text.Concatenated) TextOf(org.cactoos.text.TextOf) HasString(org.llorllale.cactoos.matchers.HasString) InputOf(org.cactoos.io.InputOf) IsEqual(org.hamcrest.core.IsEqual) Test(org.junit.jupiter.api.Test)

Example 2 with Endless

use of org.cactoos.iterable.Endless in project cactoos by yegor256.

the class InputAsBytesTest method readsLargeInMemoryContent.

@Test
void readsLargeInMemoryContent() throws Exception {
    final int multiplier = 5_000;
    final String body = "1234567890";
    new Assertion<>("must read large content from in-memory Input", new InputAsBytes(new InputOf(String.join("", new HeadOf<>(multiplier, new Endless<>(body))))).asBytes().length, new IsEqual<>(body.length() * multiplier)).affirm();
}
Also used : Endless(org.cactoos.iterable.Endless) InputOf(org.cactoos.io.InputOf) IsEqual(org.hamcrest.core.IsEqual) Test(org.junit.jupiter.api.Test)

Aggregations

InputOf (org.cactoos.io.InputOf)2 Endless (org.cactoos.iterable.Endless)2 IsEqual (org.hamcrest.core.IsEqual)2 Test (org.junit.jupiter.api.Test)2 Concatenated (org.cactoos.text.Concatenated)1 TextOf (org.cactoos.text.TextOf)1 HasString (org.llorllale.cactoos.matchers.HasString)1