use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class InputStreamOfTest method readsFromTextWithCharset.
@Test
public void readsFromTextWithCharset() throws Exception {
final File file = this.folder.newFile("readTextWithCharset.txt-5");
final String content = "Content for reading text with charset";
new LengthOf(new TeeInput(content, file)).value();
new Assertion<>("Must read from text with charset", new TextOf(new InputStreamOf(new TextOf(file), StandardCharsets.UTF_8.name())), new IsText(content)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class InputStreamOfTest method readsFromUri.
@Test
public void readsFromUri() throws Exception {
final String content = "Content for reading through URI";
final File file = this.folder.newFile("readFromUri.txt-3");
new LengthOf(new TeeInput(content, file)).value();
new Assertion<>("Must read from URI", new TextOf(new InputStreamOf(file.toURI())), new IsText(content)).affirm();
}
use of org.cactoos.scalar.LengthOf in project cactoos by yegor256.
the class TeeInputFromCharSequenceTest method copiesFromCharSequenceToFile.
@Test
public void copiesFromCharSequenceToFile() throws Exception {
final String input = "Hello, товарищ file #1 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(input, output)).value();
new Assertion<>("char sequence 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 TeeInputFromCharSequenceTest method copiesFromCharSequenceWithCharsetByNameToOutput.
@Test
public void copiesFromCharSequenceWithCharsetByNameToOutput() throws Exception {
final String input = "Hello, товарищ output #3 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(input, new OutputTo(output), StandardCharsets.UTF_8.name())).value();
new Assertion<>("char sequence 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 TeeInputFromInputTest method copiesFromInputWithCharsetByNameToWriter.
@Test
public void copiesFromInputWithCharsetByNameToWriter() throws Exception {
final String input = "Hello, товарищ writer #5 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new InputOf(input), new WriterTo(output), StandardCharsets.UTF_8.name())).value();
new Assertion<>("Must copy from input with charset by name to output", new InputOf(output), new HasContent(input)).affirm();
}
Aggregations