use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromCharArrayTest method copiesFromCharArrayToFile.
@Test
public void copiesFromCharArrayToFile() throws Exception {
final File output = this.folder.newFile();
final String input = "Hello, товарищ file äÄ üÜ öÖ and ß";
new LengthOf(new TeeInput(input.toCharArray(), output)).value();
new Assertion<>("char array must be copied to the file", new InputOf(output), new HasContent(input)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromCharArrayTest method copiesFromCharArrayWithCharsetByNameToOutput.
@Test
public void copiesFromCharArrayWithCharsetByNameToOutput() throws Exception {
final String input = "Hello, товарищ output #3 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(input.toCharArray(), new OutputTo(output), StandardCharsets.UTF_8.name())).value();
new Assertion<>("char array must be copied to the output with UTF_8 charset's name", new InputOf(output), new HasContent(input)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromCharArrayTest method copiesFromCharArrayToPath.
@Test
public void copiesFromCharArrayToPath() throws Exception {
final String input = "Hello, товарищ path #1 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(input.toCharArray(), output.toPath())).value();
new Assertion<>("char array must be copied to the path", new InputOf(output), new HasContent(input)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromFileTest method copiesFromFileToFile.
@Test
public void copiesFromFileToFile() throws Exception {
final String message = "Hello, товарищ file #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, output)).value();
new Assertion<>("Must copy from input file to output file", new InputOf(output), new HasContent(message)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromUriTest method copiesFromUriToFile.
@Test
public void copiesFromUriToFile() throws Exception {
final String message = "Hello, товарищ file #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(), output)).value();
new Assertion<>("Must copy from URI to file.", new InputOf(output), new HasContent(message)).affirm();
}
Aggregations