use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromReaderTest method copiesFromReaderWithCharsetByNameToOutput.
@Test
public void copiesFromReaderWithCharsetByNameToOutput() throws Exception {
final String input = "Hello, товарищ output #5 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new ReaderOf(input), new OutputTo(output), StandardCharsets.UTF_8.name())).value();
new Assertion<>("Must copy from reader with charset by name to output.", new InputOf(output), new HasContent(input)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromReaderTest method copiesFromReaderWithCharsetAndSizeToFile.
@Test
public void copiesFromReaderWithCharsetAndSizeToFile() throws Exception {
final String input = "Hello, товарищ file #4 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new ReaderOf(input), output, StandardCharsets.UTF_8, input.length())).value();
new Assertion<>("Must copy from reader with charset and size to file.", new InputOf(output), new HasContent(input)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromReaderTest method copiesFromReaderWithSizeToPath.
@Test
public void copiesFromReaderWithSizeToPath() throws Exception {
final String input = "Hello, товарищ path #2 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new ReaderOf(input), output.toPath(), input.length())).value();
new Assertion<>("Must copy from reader with size to path", new InputOf(output), new HasContent(input)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromReaderTest method copiesFromReaderWithCharsetByNameAndSizeToFile.
@Test
public void copiesFromReaderWithCharsetByNameAndSizeToFile() throws Exception {
final String input = "Hello, товарищ file #6 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new ReaderOf(input), output, StandardCharsets.UTF_8.name(), input.length())).value();
new Assertion<>("Must copy from reader with charset by name and size to file.", new InputOf(output), new HasContent(input)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromReaderTest method copiesFromReaderToPath.
@Test
public void copiesFromReaderToPath() throws Exception {
final String input = "Hello, товарищ path #1 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new ReaderOf(input), output.toPath())).value();
new Assertion<>("Must copy from reader to path.", new InputOf(output), new HasContent(input)).affirm();
}
Aggregations