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();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfTest method readsFromInputStream.
@Test
void readsFromInputStream() throws Exception {
final String content = "line1";
final InputStream stream = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8.name()));
new Assertion<>("Can't read inputStream", new TextOf(stream), new IsText(new String(content.getBytes(), StandardCharsets.UTF_8))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfDateTimeTest method localDateTimeFormattedWithFormatStringWithLocale.
@Test
void localDateTimeFormattedWithFormatStringWithLocale() {
final LocalDateTime date = LocalDateTime.of(2017, 12, 13, 14, 15, 16, 17);
new Assertion<>("Must format a LocalDateTime with format using locale.", new TextOfDateTime("yyyy MMM dd. HH.mm.ss", date, Locale.FRENCH), new IsText("2017 déc. 13. 14.15.16")).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfDateTimeTest method localDateTimeFormattedWithFormatString.
@Test
void localDateTimeFormattedWithFormatString() {
final LocalDateTime date = LocalDateTime.of(2017, 12, 13, 14, 15, 16, 17);
new Assertion<>("Must format a LocalDateTime with format.", new TextOfDateTime("yyyy-MM-dd HH:mm:ss", date), new IsText("2017-12-13 14:15:16")).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfDateTimeTest method readsLocalDateFormattedWithFormatStringWithLocale.
@Test
void readsLocalDateFormattedWithFormatStringWithLocale() {
final LocalDate date = LocalDate.of(2017, 12, 13);
new Assertion<>("Must format a LocalDate with format using locale.", new TextOfDateTime("yyyy MMM dd. HH.mm.ss", date, Locale.FRENCH), new IsText("2017 déc. 13. 00.00.00")).affirm();
}
Aggregations