Search in sources :

Example 1 with Mapped

use of org.cactoos.iterable.Mapped in project cactoos by yegor256.

the class ListOfTest method makesListFromMappedIterable.

@Test
public void makesListFromMappedIterable() throws Exception {
    final List<Integer> list = new ListOf<>(new Mapped<Integer>(i -> i + 1, new IterableOf<>(1, -1, 0, 1)));
    MatcherAssert.assertThat("Can't turn a mapped iterable into a list", list, new HasSize(4));
    MatcherAssert.assertThat("Can't turn a mapped iterable into a list, again", list, new HasSize(4));
}
Also used : List(java.util.List) MatcherAssert(org.hamcrest.MatcherAssert) HasSize(org.llorllale.cactoos.matchers.HasSize) IsEqual(org.hamcrest.core.IsEqual) IterableOf(org.cactoos.iterable.IterableOf) Test(org.junit.Test) Collections(java.util.Collections) Mapped(org.cactoos.iterable.Mapped) IterableOf(org.cactoos.iterable.IterableOf) HasSize(org.llorllale.cactoos.matchers.HasSize) Test(org.junit.Test)

Aggregations

Collections (java.util.Collections)1 List (java.util.List)1 IterableOf (org.cactoos.iterable.IterableOf)1 Mapped (org.cactoos.iterable.Mapped)1 MatcherAssert (org.hamcrest.MatcherAssert)1 IsEqual (org.hamcrest.core.IsEqual)1 Test (org.junit.Test)1 HasSize (org.llorllale.cactoos.matchers.HasSize)1