use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class TeeInputFromTextTest method copiesFromTextToOutput.
@Test
public void copiesFromTextToOutput() throws Exception {
final String input = "Hello, товарищ output #1 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new TextOf(input), new OutputTo(output))).value();
new Assertion<>("text must be copied to the output", new InputOf(output), new HasContent(input)).affirm();
}
use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class TeeInputFromTextTest method copiesFromTextWithCharsetByNameToOutput.
@Test
public void copiesFromTextWithCharsetByNameToOutput() throws Exception {
final String input = "Hello, товарищ output #3 äÄ üÜ öÖ and ß";
final File output = this.folder.newFile();
new LengthOf(new TeeInput(new TextOf(input), new OutputTo(output), StandardCharsets.UTF_8.name())).value();
new Assertion<>("text 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 TeeInputFromUrlTest method copiesFromUrlToOutput.
@Test
public void copiesFromUrlToOutput() 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().toURL(), new OutputTo(output))).value();
new Assertion<>("Must copy from URL to output.", new InputOf(output), new HasContent(message)).affirm();
}
use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class TeeInputFromUrlTest method copiesFromUrlToPath.
@Test
public void copiesFromUrlToPath() throws Exception {
final String message = "Hello, товарищ path #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().toURL(), output.toPath())).value();
new Assertion<>("Must copy from URL to path.", new InputOf(output), new HasContent(message)).affirm();
}
use of org.llorllale.cactoos.matchers.HasContent in project cactoos by yegor256.
the class WriterToTest method writesLargeContentToFile.
@Test
public void writesLargeContentToFile() throws IOException {
final Path temp = this.folder.newFile("cactoos-1.txt-1").toPath();
new Assertion<>("Can't copy Input to Output and return Input", new TeeInput(new ResourceOf("org/cactoos/large-text.txt"), new WriterAsOutput(new WriterTo(temp))), new HasContent(new TextOf(temp))).affirm();
}
Aggregations