use of org.cactoos.text.TextOf in project cactoos by yegor256.
the class TeeOutputTest method copiesWithOutputStream.
@Test
public void copiesWithOutputStream() {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
new Assertion<>("Can't copy Output with output stream", new TeeInput(new InputOf("Hello, товарищ! with output stream"), new TeeOutput(new OutputTo(baos), new ByteArrayOutputStream())), new HasContent(new TextOf(baos::toByteArray, StandardCharsets.UTF_8))).affirm();
}
use of org.cactoos.text.TextOf in project cactoos by yegor256.
the class TeeInputFromTextTest method copiesFromTextToPath.
@Test
public void copiesFromTextToPath() throws Exception {
final String input = "Hello, товарищ path #1 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new TextOf(input), output.toPath())).value();
new Assertion<>("text must be copied to the path", new InputOf(output), new HasContent(input)).affirm();
}
use of org.cactoos.text.TextOf in project cactoos by yegor256.
the class OutputStreamToTest method writesLargeContentToFile.
@Test
public void writesLargeContentToFile() throws IOException {
final Path temp = this.folder.newFile("cactoos-1.txt-1").toPath();
new Assertion<>("Must copy Input to Output and return Input", new TextOf(new Sticky(new TeeInput(new ResourceOf("org/cactoos/large-text.txt"), new OutputTo(new OutputStreamTo(temp))))), new IsText(new TextOf(temp))).affirm();
}
use of org.cactoos.text.TextOf in project cactoos by yegor256.
the class ReaderOfTest method readsUrl.
@Test
public void readsUrl() throws Exception {
final String message = "URL on äÄ üÜ öÖ ß жш";
final File input = this.folder.newFile();
Files.write(input.toPath(), message.getBytes(StandardCharsets.UTF_8));
new Assertion<>("Must read from url", new TextOf(new ReaderOf(input.toURI().toURL())), new IsText(message)).affirm();
}
use of org.cactoos.text.TextOf in project cactoos by yegor256.
the class ReaderOfTest method readsPath.
@Test
public void readsPath() throws Exception {
final String message = "path on äÄ üÜ öÖ ß жш";
final File input = this.folder.newFile();
Files.write(input.toPath(), message.getBytes(StandardCharsets.UTF_8));
new Assertion<>("Must read from path", new TextOf(new ReaderOf(input)), new IsText(message)).affirm();
}
Aggregations