{
String[] readFields = { "1,2" };
TypeInformation<?> type = new TupleTypeInfo<Tuple3<Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO);
SingleInputSemanticProperties sp = SemanticPropUtil.getSemanticPropsSingleFromString(null, null, readFields, type, type);
FieldSet fs = sp.getReadFields();
Assert.assertTrue(fs.size() == 2);
Assert.assertTrue(fs.contains(2));
Assert.assertTrue(fs.contains(1));
}
// with spaces
{
String[] readFields = { " 1 , 2 " };
TypeInformation<?> type = new TupleTypeInfo<Tuple3<Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO);
SingleInputSemanticProperties sp = SemanticPropUtil.getSemanticPropsSingleFromString(null, null, readFields, type, type);
FieldSet fs = sp.getReadFields();
Assert.assertTrue(fs.size() == 2);
Assert.assertTrue(fs.contains(2));
Assert.assertTrue(fs.contains(1));
}
}