Search in sources :

Example 6 with TextHasString

use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.

the class AbbreviatedTextTest method abbreviatesTextOneCharBigger.

@Test
public void abbreviatesTextOneCharBigger() {
    final String msg = "the old mcdonald";
    MatcherAssert.assertThat("Can't abbreviate a text one char bigger", // @checkstyle MagicNumber (1 line)
    new AbbreviatedText(msg, 17), new TextHasString(msg));
}
Also used : TextHasString(org.cactoos.matchers.TextHasString) TextHasString(org.cactoos.matchers.TextHasString) Test(org.junit.Test)

Example 7 with TextHasString

use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.

the class RotatedTextTest method noRotateWhenShiftZero.

@Test
public void noRotateWhenShiftZero() {
    final String nonrotate = "Cactoos!";
    MatcherAssert.assertThat("Rotate text shift zero", new RotatedText(new TextOf(nonrotate), 0), new TextHasString(nonrotate));
}
Also used : TextHasString(org.cactoos.matchers.TextHasString) TextHasString(org.cactoos.matchers.TextHasString) Test(org.junit.Test)

Example 8 with TextHasString

use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.

the class AbbreviatedTextTest method abbreviatesTextWithWidthBiggerThanLength.

@Test
public void abbreviatesTextWithWidthBiggerThanLength() {
    final String msg = "cactoos framework";
    MatcherAssert.assertThat("Can't abbreviate a text with width bigger than length", // @checkstyle MagicNumber (1 line)
    new AbbreviatedText(msg, 50), new TextHasString(msg));
}
Also used : TextHasString(org.cactoos.matchers.TextHasString) TextHasString(org.cactoos.matchers.TextHasString) Test(org.junit.Test)

Example 9 with TextHasString

use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.

the class ReplacedTextTest method notReplaceTextWhenSubstringNotFound.

@Test
public void notReplaceTextWhenSubstringNotFound() {
    final String text = "HelloAgain!";
    MatcherAssert.assertThat("Replace a text abnormally", new ReplacedText(new TextOf(text), "xyz", "i"), new TextHasString(text));
}
Also used : TextHasString(org.cactoos.matchers.TextHasString) TextHasString(org.cactoos.matchers.TextHasString) Test(org.junit.Test)

Example 10 with TextHasString

use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.

the class RotatedTextTest method noRotateWhenShiftModZero.

@Test
public void noRotateWhenShiftModZero() {
    final String nonrotate = "Rotate";
    MatcherAssert.assertThat("Rotate text shift mod zero", new RotatedText(new TextOf(nonrotate), nonrotate.length()), new TextHasString(nonrotate));
}
Also used : TextHasString(org.cactoos.matchers.TextHasString) TextHasString(org.cactoos.matchers.TextHasString) Test(org.junit.Test)

Aggregations

TextHasString (org.cactoos.matchers.TextHasString)10 Test (org.junit.Test)10 FileOutputStream (java.io.FileOutputStream)2 OutputStreamWriter (java.io.OutputStreamWriter)2 Path (java.nio.file.Path)2 MatcherOf (org.cactoos.matchers.MatcherOf)2 TextOf (org.cactoos.text.TextOf)2