use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class TeeInputFromReaderTest method copiesFromReaderWithCharsetByNameAndSizeToOutput.
@Test
public void copiesFromReaderWithCharsetByNameAndSizeToOutput() throws Exception {
final String input = "Hello, товарищ output #6 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new ReaderOf(input), new OutputTo(output), StandardCharsets.UTF_8.name(), input.length())).value();
new Assertion<>("Must copy from reader with charset by name and size to output.", new InputOf(output), new HasContent(input)).affirm();
}
use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class OutputToTest method writesIntoWriterWithCharset.
@Test
public void writesIntoWriterWithCharset() throws Exception {
final String txt = "Hello, writer with charset!";
final StringWriter output = new StringWriter();
new LengthOf(new TeeInput(txt, new OutputTo(output, StandardCharsets.UTF_8))).value();
new Assertion<>("Must write into writer with charset", new InputOf(output.getBuffer()), new HasContent(txt)).affirm();
}
use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class OutputToTest method writesIntoWriterWithCharsetByNameAndSize.
@Test
public void writesIntoWriterWithCharsetByNameAndSize() throws Exception {
final String txt = "Hello, writer with charset by name and size!";
final StringWriter output = new StringWriter();
new LengthOf(new TeeInput(txt, new OutputTo(output, StandardCharsets.UTF_8.name(), 1))).value();
new Assertion<>("Must write into writer with charset by name and size", new InputOf(output.getBuffer()), new HasContent(txt)).affirm();
}
use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class OutputToTest method writesIntoPath.
@Test
public void writesIntoPath() throws Exception {
final Path temp = this.folder.newFolder("cactoos-1").toPath();
final Path path = temp.resolve("one/two/three/file.txt");
final String content = "Hello, товарищ!";
new LengthOf(new TeeInput(content, new OutputTo(path))).value();
new Assertion<>("Must write into path", new InputOf(path), new HasContent(content)).affirm();
}
use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class OutputToTest method writesIntoWriterWithCharsetAndSize.
@Test
public void writesIntoWriterWithCharsetAndSize() throws Exception {
final String txt = "Hello, writer with charset and size!";
final StringWriter output = new StringWriter();
new LengthOf(new TeeInput(txt, new OutputTo(output, StandardCharsets.UTF_8, 1))).value();
new Assertion<>("Must write into writer with charset and size", new InputOf(output.getBuffer()), new HasContent(txt)).affirm();
}
Aggregations