use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class InputStreamOfTest method readsSimpleFileContent.
@Test
public void readsSimpleFileContent() throws IOException {
final Path temp = this.folder.newFile("cactoos-1.txt-1").toPath();
final String content = "Hello, товарищ!";
Files.write(temp, content.getBytes(StandardCharsets.UTF_8));
new Assertion<>("Must read file content", new InputOf(new InputStreamOf(temp)), new HasContent(content)).affirm();
}
use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class InputOfTest method readsSimpleFileContent.
@Test
void readsSimpleFileContent(@TempDir final Path folder) throws IOException {
final Path temp = folder.resolve("cactoos-1.txt-1");
final String content = "Hello, товарищ!";
Files.write(temp, content.getBytes(StandardCharsets.UTF_8));
new Assertion<>("must read file content", new InputOf(temp), new HasContent(content)).affirm();
}
use of org.llorllale.cactoos.matchers.HasContent 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.llorllale.cactoos.matchers.HasContent 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.llorllale.cactoos.matchers.HasContent 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