use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfTest method readsEmptyInputStream.
@Test
void readsEmptyInputStream() throws Exception {
final String content = "";
final InputStream stream = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8.name()));
new Assertion<>("Can't read empty input stream", new TextOf(stream), new IsText(content)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfTest method readsClosedInputStream.
@Test
void readsClosedInputStream() throws Exception {
final String content = "content";
final InputStream stream = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8.name()));
stream.close();
new Assertion<>("Can't read closed input stream", new TextOf(stream), new IsText(content)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfTest method readsAnArrayOfBytes.
@Test
void readsAnArrayOfBytes() {
final byte[] bytes = new byte[] { (byte) 0xCA, (byte) 0xFE };
new Assertion<>("Can't read array of bytes", new TextOf(bytes), new IsText(new String(bytes, StandardCharsets.UTF_8))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfTest method readsMultilineInputStream.
@Test
void readsMultilineInputStream() throws Exception {
final String content = "line1-\nline2";
final InputStream stream = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8.name()));
new Assertion<>("Can't read multiline inputStream", new TextOf(stream), new IsText(content)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfTest method readsMultilineInputStreamWithCarriageReturn.
@Test
void readsMultilineInputStreamWithCarriageReturn() throws Exception {
final String content = "line1-\rline2";
final InputStream stream = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8.name()));
new Assertion<>("Can't read multiline inputStream with carriage return", new TextOf(stream), new IsText(content)).affirm();
}
Aggregations