@Test
public void basicUnion() throws ExecutionException, InterruptedException {

    final List<List<Integer>> elems = Arrays.asList(
            Arrays.asList(0, 100, 200),
            Arrays.asList(401, 201, 1),
            Arrays.asList(2, 302, 102)
    );
    final UnorderedUnionCursor<Integer> cursor = UnorderedUnionCursor.create(functionsFromLists(elems), null, null);
    List<Integer> results = cursor.asList().get();
    assertEquals(elems.stream().mapToInt(List::size).sum(), results.size());
    // Verify that each list is returned within the cursor in the same order as it appears in the source list.
    for (List<Integer> childCursorList : elems) {
        int pos = 0;
        for (Integer result : results) {
            if (pos < childCursorList.size() && result.equals(childCursorList.get(pos))) {
                pos++;
            }
        }
        assertEquals(childCursorList.size(), pos);
    }
    RecordCursorResult<Integer> noNextResult = cursor.getNext();
    assertThat(noNextResult.hasNext(), is(false));
    assertThat(noNextResult.getNoNextReason().isSourceExhausted(), is(true));
}