Search in sources :

Example 11 with HasString

use of org.llorllale.cactoos.matchers.HasString in project cactoos by yegor256.

the class LoggingInputTest method logMarkSupportedFromLargeTextFile.

@Test
void logMarkSupportedFromLargeTextFile() throws Exception {
    final Logger logger = new FakeLogger();
    new LoggingInput(new ResourceOf("org/cactoos/large-text.txt"), "text file", logger).stream().markSupported();
    new Assertion<>("Must log mark and reset are not supported from text file", new TextOf(logger.toString()), new HasString("Mark and reset are supported from text file")).affirm();
}
Also used : HasString(org.llorllale.cactoos.matchers.HasString) TextOf(org.cactoos.text.TextOf) Logger(java.util.logging.Logger) Test(org.junit.jupiter.api.Test)

Example 12 with HasString

use of org.llorllale.cactoos.matchers.HasString in project cactoos by yegor256.

the class LoggingInputTest method logAvailableFromLargeTextFile.

@Test
void logAvailableFromLargeTextFile() throws Exception {
    final Logger logger = new FakeLogger();
    new LoggingInput(new ResourceOf("org/cactoos/large-text.txt"), "text file", logger).stream().available();
    new Assertion<>("Must log avaliable byte(s) from text file", new TextOf(logger.toString()), new HasString("There is(are) 74536 byte(s) available from text file")).affirm();
}
Also used : HasString(org.llorllale.cactoos.matchers.HasString) TextOf(org.cactoos.text.TextOf) Logger(java.util.logging.Logger) Test(org.junit.jupiter.api.Test)

Example 13 with HasString

use of org.llorllale.cactoos.matchers.HasString in project cactoos by yegor256.

the class ReplacedTest method notReplaceTextWhenSubstringNotFound.

@Test
void notReplaceTextWhenSubstringNotFound() {
    final String text = "HelloAgain!";
    new Assertion<>("Replace a text abnormally", new Replaced(new TextOf(text), "xyz", "i"), new HasString(text)).affirm();
}
Also used : HasString(org.llorllale.cactoos.matchers.HasString) HasString(org.llorllale.cactoos.matchers.HasString) Test(org.junit.jupiter.api.Test)

Example 14 with HasString

use of org.llorllale.cactoos.matchers.HasString in project cactoos by yegor256.

the class RotatedTest method noRotateWhenShiftModZero.

@Test
void noRotateWhenShiftModZero() {
    final String nonrotate = "Rotate";
    new Assertion<>("Rotate text shift mod zero", new Rotated(new TextOf(nonrotate), nonrotate.length()), new HasString(nonrotate)).affirm();
}
Also used : HasString(org.llorllale.cactoos.matchers.HasString) HasString(org.llorllale.cactoos.matchers.HasString) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)14 HasString (org.llorllale.cactoos.matchers.HasString)14 TextOf (org.cactoos.text.TextOf)11 Logger (java.util.logging.Logger)10 LengthOf (org.cactoos.scalar.LengthOf)6 AllOf (org.hamcrest.core.AllOf)3 InputStream (java.io.InputStream)1 Text (org.cactoos.Text)1