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