use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class StickyTest method cachesResult.
@Test
void cachesResult() {
final Text sticky = new Sticky(new Randomized());
new Assertion<>("must be the same", sticky, new IsText(sticky)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfDateTimeTest method readsLocalDateFormattedWithFormatString.
@Test
void readsLocalDateFormattedWithFormatString() {
final LocalDate date = LocalDate.of(2017, 12, 13);
new Assertion<>("Must format a LocalDate with format.", new TextOfDateTime("yyyy-MM-dd HH:mm:ss", date), new IsText("2017-12-13 00:00:00")).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfDateTimeTest method readsLocalDateFormattedAsIsoDateTime.
@Test
void readsLocalDateFormattedAsIsoDateTime() throws IOException {
final LocalDate date = LocalDate.of(2017, 12, 13);
new Assertion<>("Must format a LocalDate with default/ISO format.", new TextOfDateTime(date), new IsText(MessageFormat.format("2017-12-13T00:00:00{0}", date.atTime(LocalTime.MIN).atZone(ZoneId.systemDefault()).getOffset().toString()))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfDateTimeTest method localDateTimeFormattedAsIsoDateTime.
@Test
void localDateTimeFormattedAsIsoDateTime() {
final LocalDateTime date = LocalDateTime.of(2017, 12, 13, 14, 15, 16, 17);
new Assertion<>("Must format a LocalDateTime with default/ISO format.", new TextOfDateTime(date), new IsText(MessageFormat.format("2017-12-13T14:15:16.000000017{0}", date.atZone(ZoneId.systemDefault()).getOffset().toString()))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfDateTimeTest method dateFormattedUsingIsoFormatter.
@Test
void dateFormattedUsingIsoFormatter() {
final Calendar calendar = Calendar.getInstance(TimeZone.getDefault());
calendar.set(2017, Calendar.DECEMBER, 13, 14, 15, 16);
calendar.set(Calendar.MILLISECOND, 17);
final ZoneOffset offset = calendar.getTimeZone().toZoneId().getRules().getOffset(calendar.toInstant());
new Assertion<>("Must format a java.util.Date with ISO format.", new TextOfDateTime(calendar.getTime()), new IsText("2017-12-13T14:15:16.017" + offset)).affirm();
}
Aggregations