use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfDateTimeTest method offsetDateTimeFormattedWithFormatString.
@Test
void offsetDateTimeFormattedWithFormatString() {
final OffsetDateTime date = OffsetDateTime.of(2017, 12, 13, 14, 15, 16, 17, ZoneOffset.ofHours(1));
new Assertion<>("Must format a OffsetDateTime 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 zonedDateTimeFormattedWithFormatString.
@Test
void zonedDateTimeFormattedWithFormatString() {
final ZonedDateTime date = ZonedDateTime.of(2017, 12, 13, 14, 15, 16, 17, ZoneId.of("Europe/Berlin"));
new Assertion<>("Must format a ZonedDateTime 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 ComparableTextTest method equalsOfDifferentText.
@Test
public void equalsOfDifferentText() {
final Text text = new ComparableText(new TextOf("my value"));
new Assertion<>("Is equal to the completely different object", text, new IsNot<>(new IsEqual<>("The string is ignored"))).affirm();
new Assertion<>("Is equal to the completely different text", text, new IsNot<>(new IsText("The text is ignored"))).affirm();
new Assertion<>("Is equal to the different ComparableText", text, new IsNot<>(new IsEqual<>(new ComparableText(new TextOf("A different text"))))).affirm();
new Assertion<>("The string is equal to the different ComparableText", text, new IsNot<>(new IsText(new ComparableText(new TextOf("A different value"))))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class ReaderOfTest method readsFile.
@Test
public void readsFile() throws Exception {
final String message = "file on äÄ üÜ öÖ ß жш";
final File input = this.folder.newFile();
Files.write(input.toPath(), message.getBytes(StandardCharsets.UTF_8));
new Assertion<>("Must read from file", new TextOf(new ReaderOf(input)), new IsText(message)).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class ReaderOfTest method readsUri.
@Test
public void readsUri() throws Exception {
final String message = "URI on äÄ üÜ öÖ ß жш";
final File input = this.folder.newFile();
Files.write(input.toPath(), message.getBytes(StandardCharsets.UTF_8));
new Assertion<>("Must read from uri", new TextOf(new ReaderOf(input.toURI())), new IsText(message)).affirm();
}
Aggregations