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();
}
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();
}
Aggregations