use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TeeOutputTest method copiesWithPath.
@Test
public void copiesWithPath() throws Exception {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final File file = this.folder.newFile();
new Assertion<>("Must copy Output with path", new TextOf(new TeeInput(new InputOf("Hello, товарищ! with path"), new TeeOutput(new OutputTo(baos), file.toPath()))), new IsText(new TextOf(file.toPath()))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class OutputStreamToTest method writesLargeContentToFile.
@Test
public void writesLargeContentToFile() throws IOException {
final Path temp = this.folder.newFile("cactoos-1.txt-1").toPath();
new Assertion<>("Must copy Input to Output and return Input", new TextOf(new Sticky(new TeeInput(new ResourceOf("org/cactoos/large-text.txt"), new OutputTo(new OutputStreamTo(temp))))), new IsText(new TextOf(temp))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class ReaderOfTest method readsUrl.
@Test
public void readsUrl() throws Exception {
final String message = "URL on äÄ üÜ öÖ ß жш";
final File input = this.folder.newFile();
Files.write(input.toPath(), message.getBytes(StandardCharsets.UTF_8));
new Assertion<>("Must read from url", new TextOf(new ReaderOf(input.toURI().toURL())), new IsText(message)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class ReaderOfTest method readsPath.
@Test
public void readsPath() throws Exception {
final String message = "path on äÄ üÜ öÖ ß жш";
final File input = this.folder.newFile();
Files.write(input.toPath(), message.getBytes(StandardCharsets.UTF_8));
new Assertion<>("Must read from path", new TextOf(new ReaderOf(input)), new IsText(message)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class ImmutableTest method decoratesToString.
@Test
public void decoratesToString() throws Exception {
final String string = new Randomized().asString();
final Iterator<Object> iterator = new Iterator<Object>() {
public Object next() {
return new Object();
}
public boolean hasNext() {
return false;
}
public String toString() {
return string;
}
};
final Iterator<Object> immutable = new Immutable<>(iterator);
new Assertion<>("must delegate toString to decorated iterator", new TextOf(immutable.toString()), new IsText(iterator.toString())).affirm();
}
Aggregations