use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class TextOfDateTimeTest method zonedDateTimeFormattedAsIsoDateTime.
@Test
void zonedDateTimeFormattedAsIsoDateTime() {
final ZonedDateTime date = ZonedDateTime.of(2017, 12, 13, 14, 15, 16, 17, ZoneId.of("Europe/Berlin"));
new Assertion<>("Must format a ZonedDateTime with default/ISO format.", new TextOfDateTime(date), new IsText("2017-12-13T14:15:16.000000017+01:00")).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class FlattenedTest method flattens.
@Test
void flattens() {
final Text txt = new TextOf("txt");
final Scalar<Text> sclr = new Constant<>(txt);
new Assertion<>("must flatten", new Flattened<>(new ScalarOf<>(() -> sclr)), new HasValue<>(new IsText(txt))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class SortedTest method mustSortTextIterableAsSetUsingCustomCOmparator.
@Test
@SuppressWarnings("unchecked")
void mustSortTextIterableAsSetUsingCustomCOmparator() {
new Assertion<>("Must keep unique integer numbers sorted in descending order", new Sorted<Text>((first, second) -> {
final String left = new UncheckedText(first).asString();
final String right = new UncheckedText(second).asString();
return left.compareTo(right);
}, new TextOf("cd"), new TextOf("ab"), new TextOf("gh"), new TextOf("ef")), new IsIterableContainingInOrder<Text>(new ListOf<>(new IsText("ab"), new IsText("cd"), new IsText("ef"), new IsText("gh")))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class AbbreviatedTest method abbreviatesTextThatChanges.
@Test
@SuppressWarnings("unchecked")
void abbreviatesTextThatChanges() {
final AtomicInteger counter = new AtomicInteger(0);
final Text txt = new TextOf(() -> {
final String result;
if (counter.getAndIncrement() == 0) {
result = "The quick brown fox jumps";
} else {
result = "The lazy black dog";
}
return result;
});
new Assertion<>("Must abbreviate a text that changes", new Abbreviated(txt, 15), new AllOf<>(new IsText("The quick br..."), new IsText("The lazy bla..."))).affirm();
}
use of org.llorllale.cactoos.matchers.IsText in project cactoos by yegor256.
the class ComparableTextTest method equalsToItself.
@Test
public void equalsToItself() {
final Text text = new TextOf("text");
new Assertion<>("Does not equal to itself", text, new IsText(text)).affirm();
}
Aggregations