use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class CloseShieldOutputStreamTest method writesContentToFile.
@Test
void writesContentToFile(@TempDir final Path tempdir) throws IOException {
final File file = new File(tempdir.toFile(), "cactoos-1.txt-1");
file.createNewFile();
final Path temp = file.toPath();
try (OutputStream out = new OutputStreamTo(temp)) {
new Assertion<>("Must copy Input to Output and return Input", new TextOf(new Sticky(new TeeInput(new ResourceOf("org/cactoos/small-text.txt"), new OutputTo(new CloseShieldOutputStream(out))))), new IsText(new TextOf(temp))).affirm();
}
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class BytesOfTest method readsFromReader.
@Test
void readsFromReader() throws Exception {
final String source = "hello, друг!";
new Assertion<>("must read string through a reader", new TextOf(new Sticky(new InputOf(new BytesOf(new StringReader(source), StandardCharsets.UTF_8, // @checkstyle MagicNumberCheck (1 line)
16 << 10)))), new IsText(source)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfTest method readsReaderIntoTextWithSmallBuffer.
@Test
void readsReaderIntoTextWithSmallBuffer() {
final String text = "Hi there! with small buffer";
new Assertion<>("Can't read text from Reader with a small reading buffer", new TextOf(new StringReader(text), 2, StandardCharsets.UTF_8), new IsText(text)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfTest method readsFromReaderWithDefaultEncoding.
@Test
void readsFromReaderWithDefaultEncoding() {
final String source = "hello, друг! with default encoding";
new Assertion<>("Can't read string with default encoding through a reader", new TextOf(new StringReader(source)), new IsText(source)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfTest method readsFromReader.
@Test
void readsFromReader() {
final String source = "hello, друг!";
new Assertion<>("Can't read string through a reader", new TextOf(new StringReader(source), StandardCharsets.UTF_8), new IsText(source)).affirm();
}
Aggregations