FilterBuilderInfo filterBuilder = canvas.getChildren(FilterBuilderInfo.class).get(0);
ListGridInfo listGrid = canvas.getChildren(ListGridInfo.class).get(0);
DataSourceInfo dataSource;
{
Property property = listGrid.getPropertyByTitle("dataSource");
ObjectPropertyEditor editor = (ObjectPropertyEditor) property.getEditor();
dataSource = (DataSourceInfo) editor.getValueComponent(property);
}
//
assertThat(filterBuilder.getChildren()).isEmpty();
assertThat(filterBuilder.getDataSource()).isNull();
Property property = filterBuilder.getPropertyByTitle("dataSource");
assertThat(property).isNotNull();
assertThat(property.getValue()).isNotNull(); // fake data source used
// assign DataSiurce
ObjectPropertyEditor editor = (ObjectPropertyEditor) property.getEditor();
editor.setComponent((GenericProperty) property, dataSource);
canvas.refresh();
// check
assertThat(filterBuilder.getChildren()).isEmpty();
assertThat(filterBuilder.getDataSource()).isSameAs(dataSource);
assertThat(property.getValue()).isSameAs(dataSource.getObject());