use of org.drools.workbench.models.testscenarios.backend.MyCollectionWrapper in project drools by kiegroup.
the class FactPopulatorTest method testCollectionSums.
@Test
public void testCollectionSums() throws Exception {
TypeResolver typeResolver = getTypeResolver();
List<Field> fieldData = new ArrayList<Field>();
CollectionFieldData collectionFieldData = new CollectionFieldData();
collectionFieldData.setName("list");
fieldData.add(collectionFieldData);
collectionFieldData.getCollectionFieldList().add(new FieldData("list", "=1+3"));
FactData wrapperFactData = new FactData("MyCollectionWrapper", "wrapper", fieldData, false);
factPopulator.add(new NewFactPopulator(populatedData, typeResolver, wrapperFactData));
factPopulator.populate();
assertTrue(populatedData.containsKey("wrapper"));
MyCollectionWrapper wrapper = (MyCollectionWrapper) populatedData.get("wrapper");
assertNotNull(wrapper);
assertEquals(1, wrapper.getList().size());
assertNotNull(wrapper.getList().get(0));
assertEquals(4, wrapper.getList().get(0));
}
Aggregations