use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.
the class WriterAsOutputStreamTest method writesLargeContentToFile.
@Test
public void writesLargeContentToFile() throws IOException {
final Path temp = Files.createTempFile("cactoos-1", "txt-1");
MatcherAssert.assertThat("Can't copy Input to Output and return Input", new TextOf(new TeeInput(new ResourceOf("org/cactoos/large-text.txt"), new OutputTo(new WriterAsOutputStream(new OutputStreamWriter(new FileOutputStream(temp.toFile()), StandardCharsets.UTF_8), StandardCharsets.UTF_8, // @checkstyle MagicNumber (1 line)
345)))), new TextHasString(new MatcherOf<>(str -> {
return new TextOf(temp).asString().equals(str);
})));
}
use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.
the class WriterAsOutputTest method writesLargeContentToFile.
@Test
public void writesLargeContentToFile() throws IOException {
final Path temp = Files.createTempFile("cactoos-1", "txt-1");
MatcherAssert.assertThat("Can't copy Input to Output and return Input", new TextOf(new TeeInput(new ResourceOf("org/cactoos/large-text.txt"), new WriterAsOutput(new OutputStreamWriter(new FileOutputStream(temp.toFile()), StandardCharsets.UTF_8)))), new TextHasString(new MatcherOf<>(str -> {
return new TextOf(temp).asString().equals(str);
})));
}
use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.
the class AbbreviatedTextTest method abbreviatesTextWithSameLength.
@Test
public void abbreviatesTextWithSameLength() {
final String msg = "elegant objects";
MatcherAssert.assertThat("Can't abbreviate a text with same length", // @checkstyle MagicNumber (1 line)
new AbbreviatedText(msg, 15), new TextHasString(msg));
}
use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.
the class AbbreviatedTextTest method abbreviatesAnEmptyText.
@Test
public void abbreviatesAnEmptyText() {
final String msg = "";
MatcherAssert.assertThat("Can't abbreviate an msg text", // @checkstyle MagicNumber (1 line)
new AbbreviatedText(msg, 8), new TextHasString(msg));
}
use of org.cactoos.matchers.TextHasString in project cactoos by yegor256.
the class AbbreviatedTextTest method abbreviatesTextTwoCharsBigger.
@Test
public void abbreviatesTextTwoCharsBigger() {
final String msg = "hi everybody!";
MatcherAssert.assertThat("Can't abbreviate a text two chars bigger", // @checkstyle MagicNumber (1 line)
new AbbreviatedText(msg, 15), new TextHasString(msg));
}
Aggregations