public static StreamDescriptor createStreamDescriptor(List<OrcType> types, OrcDataSource dataSource)
    {
        ImmutableMap.Builder<Integer, StreamProperty> propertiesBuilder = ImmutableMap.builderWithExpectedSize(types.size());
        addOrcType("", "", ROOT_ID, types, propertiesBuilder);
        AllStreams allStreams = new AllStreams(dataSource, propertiesBuilder.build());
        return new StreamDescriptor(ROOT_ID, DEFAULT_SEQUENCE_ID, allStreams);
    }
@Test
    public void testBuilder()
    {
        List<OrcType> orcTypes = getOrcTypes();
        StreamDescriptor streamDescriptor = createStreamDescriptor(orcTypes, DUMMY_ORC_DATA_SOURCE);

        StreamProperty rootProperty = new StreamProperty("", orcTypes.get(0), "", ImmutableList.of(1, 2));
        StreamProperty column1Property = new StreamProperty(".column1", orcTypes.get(1), "column1", ImmutableList.of());
        StreamProperty column2Property = new StreamProperty(".column2", orcTypes.get(2), "column2", ImmutableList.of(3, 4));
        StreamProperty mapKeyProperty = new StreamProperty(".column2.key", orcTypes.get(3), "key", ImmutableList.of());
        StreamProperty mapValueProperty = new StreamProperty(".column2.value", orcTypes.get(4), "value", ImmutableList.of(5));
        StreamProperty listElementProperty = new StreamProperty(".column2.value.item", orcTypes.get(5), "item", ImmutableList.of(6, 7));
        StreamProperty inner1Property = new StreamProperty(".column2.value.item.inner1", orcTypes.get(6), "inner1", ImmutableList.of());
        StreamProperty inner2Property = new StreamProperty(".column2.value.item.inner2", orcTypes.get(7), "inner2", ImmutableList.of());

        ImmutableMap.Builder<Integer, StreamProperty> streamToPropertyMapBuilder = ImmutableMap.builder();
        streamToPropertyMapBuilder.put(0, rootProperty);
        streamToPropertyMapBuilder.put(1, column1Property);
        streamToPropertyMapBuilder.put(2, column2Property);
        streamToPropertyMapBuilder.put(3, mapKeyProperty);
        streamToPropertyMapBuilder.put(4, mapValueProperty);
        streamToPropertyMapBuilder.put(5, listElementProperty);
        streamToPropertyMapBuilder.put(6, inner1Property);
        streamToPropertyMapBuilder.put(7, inner2Property);

        Map<Integer, StreamProperty> streamPropertyMap = streamToPropertyMapBuilder.build();
        verifyStreamDescriptor(streamDescriptor, 0, 0, streamPropertyMap);

        StreamDescriptor sequenceStreamDescriptor = streamDescriptor.duplicate(10);
        verifyStreamDescriptor(sequenceStreamDescriptor, 0, 10, streamPropertyMap);
    }