use of org.kie.workbench.common.screens.datamodeller.model.editor.FieldMetadataProvider in project kie-wb-common by kiegroup.
the class DataObjectBrowserViewImplTest method addPropertyTypeBrowseColumn.
@Test
public void addPropertyTypeBrowseColumn() {
FieldMetadataProvider fieldMetadataProvider = objectProperty -> {
if ("testField".equals(objectProperty.getName())) {
ImageWrapper imageWrapper = new ImageWrapper("testUri", "testDescription");
FieldMetadata fieldMetadata = new FieldMetadata(imageWrapper);
return Optional.of(fieldMetadata);
}
return Optional.empty();
};
Instance<FieldMetadataProvider> fieldMetadataProviderInstance = new MockInstanceImpl<>(fieldMetadataProvider);
view = new DataObjectBrowserViewImpl(validationPopup, fieldMetadataProviderInstance);
Column<ObjectProperty, List<ImageWrapper>> column = view.createPropertyTypeBrowseColumn();
ObjectProperty matchingObjectProperty = new ObjectPropertyImpl("testField", "className", false);
List<ImageWrapper> imageWrapperList = column.getValue(matchingObjectProperty);
assertEquals(1, imageWrapperList.size());
ObjectProperty nonMatchingObjectProperty = new ObjectPropertyImpl("nonMatchingTestField", "className", false);
imageWrapperList = column.getValue(nonMatchingObjectProperty);
assertEquals(0, imageWrapperList.size());
}
Aggregations