PCollection<StringWrapper> stringWrapperCollection = pipeline.readTextFile(tmpDir.copyResourceFileName("set1.txt"))
.parallelDo(new MapFn<String, StringWrapper>() {
@Override
public StringWrapper map(String input) {
StringWrapper stringWrapper = new StringWrapper();
stringWrapper.setValue(input);
return stringWrapper;
}
}, Avros.reflects(StringWrapper.class));
List<StringWrapper> stringWrappers = Lists.newArrayList(stringWrapperCollection.materialize());
pipeline.done();
assertEquals(Lists.newArrayList(new StringWrapper("b"), new StringWrapper("c"), new StringWrapper("a"),
new StringWrapper("e")), stringWrappers);
}