use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromUriTest method copiesFromUriToOutput.
@Test
public void copiesFromUriToOutput() throws Exception {
final String message = "Hello, товарищ output #1 äÄ üÜ öÖ and ß";
final File input = this.folder.newFile();
Files.write(input.toPath(), message.getBytes(StandardCharsets.UTF_8));
final File output = this.folder.newFile();
new LengthOf(new TeeInput(input.toURI(), new OutputTo(output))).value();
new Assertion<>("Must copy from URI to output.", new InputOf(output), new HasContent(message)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromTextTest method copiesFromTextWithCharsetToPath.
@Test
public void copiesFromTextWithCharsetToPath() throws Exception {
final String input = "Hello, товарищ path #2 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new TextOf(input), output.toPath(), StandardCharsets.UTF_8)).value();
new Assertion<>("text must be copied to the path with UTF_8 charset", new InputOf(output), new HasContent(input)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromByteArrayTest method copiesFromByteArrayToOutput.
@Test
public void copiesFromByteArrayToOutput() throws Exception {
final String message = "Hello, товарищ output äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(message.getBytes(StandardCharsets.UTF_8), new OutputTo(output))).value();
new Assertion<>("Must copy bytes to output", new InputOf(output), new HasContent(message)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromByteArrayTest method copiesFromByteArrayToFile.
@Test
public void copiesFromByteArrayToFile() throws Exception {
final String message = "Hello, товарищ file äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(message.getBytes(StandardCharsets.UTF_8), output)).value();
new Assertion<>("Must copy bytes to file", new InputOf(output), new HasContent(message)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromCharArrayTest method copiesFromCharArrayWithCharsetToPath.
@Test
public void copiesFromCharArrayWithCharsetToPath() throws Exception {
final String input = "Hello, товарищ path #2 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(input.toCharArray(), output.toPath(), StandardCharsets.UTF_8)).value();
new Assertion<>("char array must be copied to the path with UTF_8 charset", new InputOf(output), new HasContent(input)).affirm();
}
Aggregations