use of org.uberfire.mocks.MockInstanceImpl 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());
}
use of org.uberfire.mocks.MockInstanceImpl in project kie-wb-common by kiegroup.
the class AbstractCanvasShortcutsControlImplTest method setUp.
@Before
public void setUp() throws Exception {
shortcuts = new MockInstanceImpl(keyboardShortcutAction);
canvasShortcutsControl = new AbstractCanvasShortcutsControlImpl(shortcuts) {
{
this.canvasHandler = canvasHandlerMock;
}
};
}
use of org.uberfire.mocks.MockInstanceImpl in project kie-wb-common by kiegroup.
the class ProjectValidationServiceImplTest method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() {
domainViolationList = Arrays.asList(domainViolation, domainViolation2, domainViolation3, domainViolation4, domainViolationNull, domainViolationNullStr);
domainValidator = new DomainValidator() {
@Override
public String getDefinitionSetId() {
return DEF_SET_ID;
}
@Override
public void validate(Diagram entity, Consumer<Collection<DomainViolation>> resultConsumer) {
resultConsumer.accept(domainViolationList);
}
};
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getDefinitionSetId()).thenReturn(DEF_SET_ID);
when(diagram.getGraph()).thenReturn(graph);
when(graph.getUUID()).thenReturn(GRAPH_UUID);
mockViolations(domainViolationList);
validationService = new ProjectValidationServiceImpl(new MockInstanceImpl(domainValidator));
}
Aggregations