use of org.kie.workbench.common.dmn.client.editors.types.common.ItemDefinitionUtils in project kie-wb-common by kiegroup.
the class DecisionTableEditorDefinitionEnricherTest method testAddInputClauseRequirementWhenDataTypeIsStructureAndDontHaveFields.
@Test
public void testAddInputClauseRequirementWhenDataTypeIsStructureAndDontHaveFields() {
final ItemDefinition tPerson = mock(ItemDefinition.class);
final String inputData = "InputData";
final List<DecisionTableEditorDefinitionEnricher.ClauseRequirement> inputClauseRequirements = new ArrayList<>();
final ItemDefinitionUtils itemDefinitionUtils = new ItemDefinitionUtils(mock(DMNGraphUtils.class));
final DecisionTableEditorDefinitionEnricher enricher = new DecisionTableEditorDefinitionEnricher(null, null, itemDefinitionUtils);
when(tPerson.getName()).thenReturn(new Name(TYPE_PERSON));
when(tPerson.getTypeRef()).thenReturn(null);
when(tPerson.getItemComponent()).thenReturn(emptyList());
enricher.addInputClauseRequirement(tPerson, inputClauseRequirements, inputData);
assertEquals(1, inputClauseRequirements.size());
assertEquals("InputData", inputClauseRequirements.get(0).text);
assertEquals(TYPE_PERSON, inputClauseRequirements.get(0).typeRef.getLocalPart());
}
use of org.kie.workbench.common.dmn.client.editors.types.common.ItemDefinitionUtils in project kie-wb-common by kiegroup.
the class DataTypePickerWidgetTest method setup.
@Before
public void setup() {
this.definitions = new Definitions();
this.definitions.getItemDefinition().add(new ItemDefinition());
this.definitions.getNsContext().put(Namespace.FEEL.getPrefix(), Namespace.FEEL.getUri());
this.qNameConverter = spy(new QNameConverter());
this.itemDefinitionUtils = spy(new ItemDefinitionUtils(dmnGraphUtils));
when(typeSelector.getElement()).thenReturn(typeSelectorElement);
when(option.getElement()).thenReturn(optionElement);
when(dmnGraphUtils.getModelDefinitions()).thenReturn(definitions);
when(dmnModel.getPrefixForNamespaceURI(Mockito.<String>any())).thenReturn(Optional.empty());
when(manageContainer.getStyle()).thenReturn(manageContainerStyle);
when(translationService.getTranslation(Mockito.<String>any())).thenAnswer(i -> i.getArguments()[0]);
when(typeButton.getClassList()).thenReturn(typeButtonClassList);
this.picker = spy(new DataTypePickerWidget(typeButton, manageContainer, manageLabel, translationService, qNameConverter, dmnGraphUtils, dataTypePageActiveEvent, itemDefinitionUtils, readOnlyProvider));
}
Aggregations