use of org.mule.runtime.api.metadata.CollectionDataType in project mule by mulesoft.
the class StreamingUtilsTestCase method consumeTypedRepeatableIteratorPayload.
@Test
@Description("Test that repeatable iterator is consumed into a list while maintaining the collection data type")
public void consumeTypedRepeatableIteratorPayload() throws Exception {
CursorIteratorProvider payload = asCursorProvider(TEST_LIST);
DataType dataType = DataType.builder().collectionType(ArrayList.class).itemType(String.class).build();
CoreEvent event = consumeRepeatablePayload(getEventBuilder().message(Message.builder().payload(new TypedValue<>(payload, dataType)).build()).build());
assertConsumedObjectStream(payload, event);
dataType = event.getMessage().getPayload().getDataType();
assertThat(dataType, is(instanceOf(CollectionDataType.class)));
assertThat(((CollectionDataType) dataType).getItemDataType(), equalTo(STRING));
}
Aggregations