Search in sources :

Example 1 with HasValues

use of org.llorllale.cactoos.matchers.HasValues in project cactoos by yegor256.

the class IteratorOfBytesTest method canBeConstructedFromText.

@Test
public void canBeConstructedFromText() throws Exception {
    final Iterator<Byte> itr = new IteratorOfBytes(new TextOf("ABC"));
    new Assertion<>("Must have 3 elements", new ListOf<Object>(itr.next(), itr.next(), itr.next(), itr.hasNext()), new HasValues<Object>((byte) 'A', (byte) 'B', (byte) 'C', false)).affirm();
}
Also used : HasValues(org.llorllale.cactoos.matchers.HasValues) ListOf(org.cactoos.list.ListOf) TextOf(org.cactoos.text.TextOf) Test(org.junit.Test)

Example 2 with HasValues

use of org.llorllale.cactoos.matchers.HasValues in project cactoos by yegor256.

the class MappedWithIndexTest method removingElementsFromIterator.

@Test
void removingElementsFromIterator() {
    final Iterator<Text> iterator = new MappedWithIndex<>((item, index) -> new FormattedText("%1$s : %2$s", index, item), new ArrayList<>(Arrays.asList("1", "2", "3")).iterator());
    iterator.next();
    iterator.remove();
    new Assertion<>("must map values of changed iterator", new IterableOf<>(iterator), new HasValues<>(new TextOf("1 : 2"), new TextOf("2 : 3"))).affirm();
}
Also used : HasValues(org.llorllale.cactoos.matchers.HasValues) IterableOf(org.cactoos.iterable.IterableOf) ArrayList(java.util.ArrayList) Text(org.cactoos.Text) FormattedText(org.cactoos.text.FormattedText) TextOf(org.cactoos.text.TextOf) FormattedText(org.cactoos.text.FormattedText) Test(org.junit.jupiter.api.Test)

Aggregations

TextOf (org.cactoos.text.TextOf)2 HasValues (org.llorllale.cactoos.matchers.HasValues)2 ArrayList (java.util.ArrayList)1 Text (org.cactoos.Text)1 IterableOf (org.cactoos.iterable.IterableOf)1 ListOf (org.cactoos.list.ListOf)1 FormattedText (org.cactoos.text.FormattedText)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1