src_fm_fc_ms_ff
stringlengths
43
86.8k
target
stringlengths
20
276k
DataTypeListShortcuts { void onArrowUp() { view.getPrevDataTypeRow().ifPresent(view::highlight); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnArrowUp() { final Element prevDataTypeRow = mock(Element.class); when(view.getPrevDataTypeRow()).thenReturn(Optional.of(prevDataTypeRow)); shortcuts.onArrowUp(); verify(view).highlight(prevDataTypeRow); }
DataTypeListShortcuts { void onTab() { view.getFirstDataTypeRow().ifPresent(view::highlight); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnTab() { final Element firstDataTypeRow = mock(Element.class); when(view.getFirstDataTypeRow()).thenReturn(Optional.of(firstDataTypeRow)); shortcuts.onTab(); verify(view).highlight(firstDataTypeRow); }
DataTypeListShortcuts { void onArrowLeft() { getCurrentDataTypeListItem().ifPresent(DataTypeListItem::collapse); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnArrowLeft() { shortcuts.onArrowLeft(); verify(listItem).collapse(); }
DataTypeListShortcuts { void onArrowRight() { getCurrentDataTypeListItem().ifPresent(DataTypeListItem::expand); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnArrowRight() { shortcuts.onArrowRight(); verify(listItem).expand(); }
DataTypeListShortcuts { void onCtrlE() { consumeIfDataTypeIsNotReadOnly(DataTypeListItem::enableEditMode); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnCtrlE() { shortcuts.onCtrlE(); verify(listItem).enableEditMode(); } @Test public void testOnCtrlEWhenDataTypeIsReadOnly() { when(listItem.isReadOnly()).thenReturn(true); shortcuts.onCtrlE(); verify(listItem, never()).enableEditMode(); }
DataTypeListShortcuts { void onCtrlBackspace() { consumeIfDataTypeIsNotReadOnly(DataTypeListItem::remove); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnBackspace() { shortcuts.onCtrlBackspace(); verify(listItem).remove(); } @Test public void testOnCtrlBackspaceWhenDataTypeIsReadOnly() { when(listItem.isReadOnly()).thenReturn(true); shortcuts.onCtrlBackspace(); verify(listItem, never()).remove(); }
DataTypeListShortcuts { void onCtrlS() { consumeIfDataTypeIsNotReadOnly(DataTypeListItem::saveAndCloseEditMode); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnCtrlS() { shortcuts.onCtrlS(); verify(listItem).saveAndCloseEditMode(); } @Test public void testOnCtrlSWhenDataTypeIsReadOnly() { when(listItem.isReadOnly()).thenReturn(true); shortcuts.onCtrlS(); verify(listItem, never()).saveAndCloseEditMode(); }
DataTypeListShortcuts { void onCtrlB() { consumeIfDataTypeIsNotReadOnly(DataTypeListItem::insertNestedField); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnCtrlB() { shortcuts.onCtrlB(); verify(listItem).insertNestedField(); } @Test public void testOnCtrlBWhenDataTypeIsReadOnly() { when(listItem.isReadOnly()).thenReturn(true); shortcuts.onCtrlB(); verify(listItem, never()).insertNestedField(); }
DataTypeListShortcuts { void onCtrlU() { consumeIfDataTypeIsNotReadOnly(DataTypeListItem::insertFieldAbove); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnCtrlU() { shortcuts.onCtrlU(); verify(listItem).insertFieldAbove(); } @Test public void testOnCtrlUWhenDataTypeIsReadOnly() { when(listItem.isReadOnly()).thenReturn(true); shortcuts.onCtrlU(); verify(listItem, never()).insertFieldAbove(); }
DataTypeListShortcuts { void onCtrlD() { consumeIfDataTypeIsNotReadOnly(DataTypeListItem::insertFieldBelow); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testOnCtrlD() { shortcuts.onCtrlD(); verify(listItem).insertFieldBelow(); } @Test public void testOnCtrlDWhenDataTypeIsReadOnly() { when(listItem.isReadOnly()).thenReturn(true); shortcuts.onCtrlD(); verify(listItem, never()).insertFieldBelow(); }
DataTypeListShortcuts { public void reset() { view.reset(); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testReset() { shortcuts.reset(); verify(view).reset(); }
DataTypeListShortcuts { void focusIn() { view.focusIn(); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testFocusIn() { shortcuts.focusIn(); verify(view).focusIn(); }
DataTypeListShortcuts { void highlight(final Element element) { dataTypeList.highlight(element); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testHighlight() { final Element element = mock(Element.class); shortcuts.highlight(element); verify(dataTypeList).highlight(element); }
DataTypeListShortcuts { void highlightLevel(final Element element) { dataTypeList.highlightLevel(element); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testHighlightLevel() { final Element element = mock(Element.class); shortcuts.highlightLevel(element); verify(dataTypeList).highlightLevel(element); }
DataTypeListShortcuts { void cleanLevelHighlightClass() { dataTypeList.cleanLevelHighlightClass(); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testCleanLevelHighlightClass() { shortcuts.cleanLevelHighlightClass(); verify(dataTypeList).cleanLevelHighlightClass(); }
DataTypeListShortcuts { void cleanHighlightClass() { dataTypeList.cleanHighlightClass(); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); void reset(); }
@Test public void testCleanHighlightClass() { shortcuts.cleanHighlightClass(); verify(dataTypeList).cleanHighlightClass(); }
InformationItemPrimaryPropertyConverter { public static TInformationItem dmnFromWB(final InformationItemPrimary wb, final DMNModelInstrumentedBase parent) { if (wb == null) { return null; } final TInformationItem result = new TInformationItem(); final QName typeRef = wb.getTypeRef(); result.setId(wb.getId().getValue())...
@Test public void testDmnFromWBWhenWBIsNull() { final InformationItemPrimary wb = null; final InformationItem informationItem = InformationItemPrimaryPropertyConverter.dmnFromWB(wb, wb); assertNull(informationItem); } @Test public void testDmnFromWBWhenWBIsNotNull() { final String expectedId = "id"; final String expect...
DataTypeListShortcuts { DataType getTopLevelParent(final DataType dataType) { return dataTypeUtils.getTopLevelParent(dataType); } @Inject DataTypeListShortcuts(final View view, final DataTypeUtils dataTypeUtils); @PostConstruct void init(); void init(final DataTypeList dataTypeList); v...
@Test public void testGetTopLevelParent() { final DataType expectedDataType = mock(DataType.class); when(dataTypeUtils.getTopLevelParent(expectedDataType)).thenReturn(expectedDataType); final DataType actualDataType = shortcuts.getTopLevelParent(expectedDataType); assertEquals(expectedDataType, actualDataType); }
DataTypeShortcuts { public void setup() { if (isLoaded()) { return; } loaded = true; addEventListener(KEYDOWN, KEY_DOWN_LISTENER); addEventListener(CLICK, CLICK_LISTENER); } @Inject DataTypeShortcuts(final DataTypeListShortcuts listShortcuts); void init(final DataTypeList dataTypeList); void setup(); void teardown(); ...
@Test public void testSetup() { doNothing().when(shortcuts).addEventListener(anyString(), any()); doReturn(false).when(shortcuts).isLoaded(); shortcuts.setup(); verify(shortcuts).addEventListener(KEYDOWN, shortcuts.KEY_DOWN_LISTENER); verify(shortcuts).addEventListener(KEYDOWN, shortcuts.KEY_DOWN_LISTENER); }
DataTypeShortcuts { public void teardown() { if (!isLoaded()) { return; } loaded = false; removeEventListener(KEYDOWN, KEY_DOWN_LISTENER); removeEventListener(CLICK, CLICK_LISTENER); } @Inject DataTypeShortcuts(final DataTypeListShortcuts listShortcuts); void init(final DataTypeList dataTypeList); void setup(); void t...
@Test public void testTeardown() { doNothing().when(shortcuts).removeEventListener(anyString(), any()); doReturn(true).when(shortcuts).isLoaded(); shortcuts.teardown(); verify(shortcuts).removeEventListener(KEYDOWN, shortcuts.KEY_DOWN_LISTENER); verify(shortcuts).removeEventListener(CLICK, shortcuts.CLICK_LISTENER); }
DataTypeShortcuts { void keyDownListener(final Event e) { if (!(e instanceof KeyboardEvent)) { return; } final KeyboardEvent event = (KeyboardEvent) e; if (isNotEnabled()) { return; } switch (event.key) { case "Esc": case "Escape": listShortcuts.onEscape(); return; case "Backspace": if (event.ctrlKey) { listShortcuts.o...
@Test public void testKeyDownListenerWhenKeyEscIsPressed() { event.key = "Esc"; shortcuts.keyDownListener(event); verify(listShortcuts).onEscape(); } @Test public void testKeyDownListenerWhenKeyEscapeIsPressed() { event.key = "Escape"; shortcuts.keyDownListener(event); verify(listShortcuts).onEscape(); } @Test public v...
InformationItemPrimaryPropertyConverter { static String getParentName(final org.kie.dmn.model.api.DMNModelInstrumentedBase parent) { if (parent instanceof NamedElement) { final NamedElement namedElement = (NamedElement) parent; final Optional<String> name = Optional.ofNullable(namedElement.getName()); return name.orEls...
@Test public void testDMNGetNameWhenParentDoesNotHaveName() { final org.kie.dmn.model.api.InformationItem parent = mock(org.kie.dmn.model.api.InformationItem.class); final String name = InformationItemPrimaryPropertyConverter.getParentName(parent); assertTrue(name.isEmpty()); } @Test public void testDMNGetNameWhenParen...
DataTypeShortcuts { boolean isTargetElementAnInput(final KeyboardEvent event) { final Element element = getTarget(event); return element instanceof HTMLInputElement; } @Inject DataTypeShortcuts(final DataTypeListShortcuts listShortcuts); void init(final DataTypeList dataTypeList); void setup(); void teardown(); void r...
@Test public void testIsTargetElementAnInputWhenItReturnsTrue() { event.target = mock(HTMLInputElement.class); assertTrue(shortcuts.isTargetElementAnInput(event)); } @Test public void testIsTargetElementAnInputWhenItReturnsFalse() { event.target = mock(HTMLDivElement.class); assertFalse(shortcuts.isTargetElementAnInput...
DataTypeShortcuts { boolean isSearchBarTarget(final KeyboardEvent event) { final Element element = getTarget(event); return Objects.equals(element.getAttribute("data-field"), "search-bar"); } @Inject DataTypeShortcuts(final DataTypeListShortcuts listShortcuts); void init(final DataTypeList dataTypeList); void setup();...
@Test public void testIsSearchBarTargetWhenItReturnsFalse() { final HTMLDivElement element = mock(HTMLDivElement.class); event.target = element; when(element.getAttribute("data-field")).thenReturn("something"); assertFalse(shortcuts.isSearchBarTarget(event)); }
DataTypeShortcuts { public void reset() { listShortcuts.reset(); } @Inject DataTypeShortcuts(final DataTypeListShortcuts listShortcuts); void init(final DataTypeList dataTypeList); void setup(); void teardown(); void reset(); void highlight(final Element element); void enable(); void disable(); }
@Test public void testReset() { shortcuts.reset(); verify(listShortcuts).reset(); }
DataTypeShortcuts { public void highlight(final Element element) { listShortcuts.highlight(element); } @Inject DataTypeShortcuts(final DataTypeListShortcuts listShortcuts); void init(final DataTypeList dataTypeList); void setup(); void teardown(); void reset(); void highlight(final Element element); void enable(); voi...
@Test public void testHighlight() { final Element element = mock(Element.class); shortcuts.highlight(element); verify(listShortcuts).highlight(element); }
ImportDataObjectModal extends Elemental2Modal<ImportDataObjectModal.View> { public void show(final List<String> existingDataTypes) { getView().hideDataTypeWithSameNameWarning(); this.existingDataTypes = existingDataTypes; client.loadDataObjects(wrap(getConsumer())); superShow(); } @Inject ImportDataObjectModal(final V...
@Test public void testShow() { final Consumer consumer = mock(Consumer.class); final ServiceCallback serviceCallback = mock(ServiceCallback.class); final List<String> existingDataTypes = mock(List.class); doReturn(serviceCallback).when(modal).wrap(consumer); doReturn(consumer).when(modal).getConsumer(); doNothing().whe...
ImportDataObjectModal extends Elemental2Modal<ImportDataObjectModal.View> { ServiceCallback<List<DataObject>> wrap(final Consumer<List<DataObject>> consumer) { return new ServiceCallback<List<DataObject>>() { @Override public void onSuccess(final List<DataObject> items) { consumer.accept(items); } @Override public void...
@Test public void testWrap() { final Consumer consumer = mock(Consumer.class); final ServiceCallback service = modal.wrap(consumer); final List<DataObject> items = mock(List.class); service.onSuccess(items); verify(consumer).accept(items); }
ImportDataObjectModal extends Elemental2Modal<ImportDataObjectModal.View> { Consumer<List<DataObject>> getConsumer() { return objects -> { getView().clear(); getView().addItems(objects); superShow(); }; } @Inject ImportDataObjectModal(final View view, final DMNClientServicesProxy clien...
@Test public void testGetConsumer() { doNothing().when(modal).superShow(); final Consumer<List<DataObject>> consumer = modal.getConsumer(); final List<DataObject> items = mock(List.class); when(items.isEmpty()).thenReturn(false); consumer.accept(items); verify(view).clear(); verify(view).addItems(items); verify(modal)....
ImportDataObjectModal extends Elemental2Modal<ImportDataObjectModal.View> { public void setup(final Consumer<List<DataObject>> dataObjectsConsumer) { this.dataObjectsConsumer = dataObjectsConsumer; callSuperSetup(); } @Inject ImportDataObjectModal(final View view, final DMNClientServic...
@Test public void testSetup() { final Consumer<List<DataObject>> consumer = mock(Consumer.class); final Consumer onDataObjectSelectionChanged = mock(Consumer.class); doNothing().when(modal).callSuperSetup(); doReturn(onDataObjectSelectionChanged).when(modal).getOnDataObjectSelectionChanged(); modal.setup(consumer); ver...
ImportDataObjectModal extends Elemental2Modal<ImportDataObjectModal.View> { public void hide(final List<DataObject> importedDataObjects) { if (!Objects.isNull(getDataObjectsConsumer())) { getDataObjectsConsumer().accept(importedDataObjects); } superHide(); } @Inject ImportDataObjectModal(final View view, ...
@Test public void testHide() { final List<DataObject> importedObjects = mock(List.class); final Consumer<List<DataObject>> consumer = mock(Consumer.class); doNothing().when(modal).callSuperSetup(); doNothing().when(modal).superHide(); modal.setup(consumer); modal.hide(importedObjects); verify(consumer).accept(importedO...
ImportDataObjectModalView implements ImportDataObjectModal.View { @Override public String getHeader() { return header.textContent; } @Inject ImportDataObjectModalView(final HTMLDivElement header, final HTMLDivElement body, final HTMLDivElement f...
@Test public void testGetHeader() { final String text = "The text"; header.textContent = text; final String actual = view.getHeader(); assertEquals(actual, text); }
ImportDataObjectModalView implements ImportDataObjectModal.View { @EventHandler("button-cancel") void onButtonCancelClicked(final ClickEvent e) { presenter.hide(); } @Inject ImportDataObjectModalView(final HTMLDivElement header, final HTMLDivElement body, ...
@Test public void testOnButtonCancelClicked() { view.onButtonCancelClicked(null); verify(presenter).hide(); }
ImportDataObjectModalView implements ImportDataObjectModal.View { @EventHandler("button-import") void onButtonImportClicked(final ClickEvent e) { final List<DataObject> selectedItems = getSelectedItems(); presenter.hide(selectedItems); } @Inject ImportDataObjectModalView(final HTMLDivElement header, ...
@Test public void testOnButtonImportClicked() { final List<DataObject> selectedItems = mock(List.class); doReturn(selectedItems).when(view).getSelectedItems(); view.onButtonImportClicked(null); verify(presenter).hide(selectedItems); }
ImportDataObjectModalView implements ImportDataObjectModal.View { List<DataObject> getSelectedItems() { return treeList.getSelectedItems().stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); } @Inject ImportDataObjectModalView(final HTMLDivElement header, fin...
@Test public void testGetSelectedItems() { final TreeListItem listItem1 = mock(TreeListItem.class); final DataObject dataObject1 = mock(DataObject.class); final TreeListItem listItem2 = mock(TreeListItem.class); final DataObject dataObject2 = mock(DataObject.class); when(listItem1.getDataSource()).thenReturn(dataObject...
ImportDataObjectModalView implements ImportDataObjectModal.View { @EventHandler("clear-selection") void onClearSelectionClicked(final ClickEvent e) { treeList.clearSelection(); refresh(); } @Inject ImportDataObjectModalView(final HTMLDivElement header, final HTMLDivElement body, ...
@Test public void testOnClearSelectionClicked() { view.onClearSelectionClicked(null); doNothing().when(view).refresh(); verify(treeList).refresh(); verify(view).refresh(); }
ImportDataObjectModalView implements ImportDataObjectModal.View { @Override public void addItems(final List<DataObject> dataObjects) { final List<TreeListItem> dataObjectItems = new ArrayList<>(); for (final DataObject data : dataObjects) { dataObjectItems.add(createTreeListItem(data)); } treeList.populate(dataObjectIt...
@Test public void testAddItems() { final String d1Name = "ClassOne"; final String d2Name = "ClassTwo"; final String d3Name = "ClassThree"; final DataObject d1 = new DataObject(d1Name); final DataObject d2 = new DataObject(d2Name); final DataObject d3 = new DataObject(d3Name); final List<DataObject> dataObjects = Arrays...
ImportDataObjectModalView implements ImportDataObjectModal.View { TreeListItem createTreeListItem(final DataObject data) { final TreeListItem item = items.get(); item.setDataSource(data); item.setDescription(data.getClassType()); return item; } @Inject ImportDataObjectModalView(final HTMLDivElement header, ...
@Test public void testCreateTreeListItem() { final TreeListItem item = mock(TreeListItem.class); when(items.get()).thenReturn(item); final String myClass = "my class"; final DataObject data = new DataObject(myClass); final TreeListItem actual = view.createTreeListItem(data); assertEquals(item, actual); verify(item).set...
ImportDataObjectModalView implements ImportDataObjectModal.View { void refresh() { removeTreeList(); treeList.refresh(); itemsContainer.appendChild(treeList.getElement()); } @Inject ImportDataObjectModalView(final HTMLDivElement header, final HTMLDivElement body, ...
@Test public void testRefresh() { doNothing().when(view).removeTreeList(); view.refresh(); verify(treeList).refresh(); verify(itemsContainer).appendChild(treeListElement); }
ImportDataObjectModalView implements ImportDataObjectModal.View { @Override public void clear() { removeTreeList(); treeList.clear(); } @Inject ImportDataObjectModalView(final HTMLDivElement header, final HTMLDivElement body, final HTMLDivElemen...
@Test public void testClear() { doNothing().when(view).removeTreeList(); view.clear(); verify(view).removeTreeList(); verify(treeList).clear(); }
ImportDataObjectModalView implements ImportDataObjectModal.View { void removeTreeList() { if (itemsContainer.contains(treeList.getElement())) { itemsContainer.removeChild(treeList.getElement()); } } @Inject ImportDataObjectModalView(final HTMLDivElement header, final HTMLDivElement...
@Test public void testRemoveTreeList() { when(itemsContainer.contains(treeListElement)).thenReturn(true); view.removeTreeList(); verify(itemsContainer).removeChild(treeListElement); } @Test public void testRemoveTreeListWhenIsNotPresent() { when(itemsContainer.contains(treeListElement)).thenReturn(false); view.removeTr...
ImportDataObjectModalView implements ImportDataObjectModal.View { @PostConstruct public void setup() { treeList.setOnSelectionChanged(getOnSelectionChanged()); } @Inject ImportDataObjectModalView(final HTMLDivElement header, final HTMLDivElement body, ...
@Test public void testSetup() { final Consumer consumer = mock(Consumer.class); doReturn(consumer).when(view).getOnSelectionChanged(); view.setup(); verify(treeList).setOnSelectionChanged(consumer); }
ImportDataObjectModalView implements ImportDataObjectModal.View { void onSelectionChanged(final List<TreeListItem> treeListItems) { final List<DataObject> selectedItems = treeListItems.stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); presenter.onDataObjectSelectionChanged(selectedItems); } @In...
@Test public void testOnSelectionChanged() { final DataObject do1 = mock(DataObject.class); final DataObject do2 = mock(DataObject.class); final DataObject do3 = mock(DataObject.class); final TreeListItem treeListItem1 = mock(TreeListItem.class); final TreeListItem treeListItem2 = mock(TreeListItem.class); final TreeLi...
ImportDataObjectModalView implements ImportDataObjectModal.View { @Override public void showDataTypeWithSameNameWarning() { warningContainer.classList.add(OPENED_CONTAINER_CSS_CLASS); } @Inject ImportDataObjectModalView(final HTMLDivElement header, final HTMLDivElement body, ...
@Test public void testShowDataTypeWithSameNameWarning() { warningContainer.classList = mock(DOMTokenList.class); view.showDataTypeWithSameNameWarning(); verify(warningContainer.classList).add(OPENED_CONTAINER_CSS_CLASS); }
ImportDataObjectModalView implements ImportDataObjectModal.View { @Override public void hideDataTypeWithSameNameWarning() { warningContainer.classList.remove(OPENED_CONTAINER_CSS_CLASS); } @Inject ImportDataObjectModalView(final HTMLDivElement header, final HTMLDivElement body, ...
@Test public void testHideDataTypeWithSameNameWarning() { warningContainer.classList = mock(DOMTokenList.class); view.hideDataTypeWithSameNameWarning(); verify(warningContainer.classList).remove(OPENED_CONTAINER_CSS_CLASS); }
TreeListItemView implements TreeListItem.View { @Override public void init(final TreeListItem presenter) { this.presenter = presenter; } @Inject TreeListItemView(final HTMLDivElement itemHeader, final HTMLDivElement itemsContainer, final HTMLDivElement itemDetail...
@Test public void testInit() { final TreeListItem presenter = mock(TreeListItem.class); itemView.init(presenter); final TreeListItem actual = itemView.getPresenter(); assertEquals(actual, presenter); }
TreeListItemView implements TreeListItem.View { @EventHandler("data-object-checkbox") public void onCheckboxChanged(final ChangeEvent valueChanged) { getPresenter().setIsSelected(checkbox.checked); } @Inject TreeListItemView(final HTMLDivElement itemHeader, final HTMLDivElement itemsContain...
@Test public void testOnCheckboxChanged() { final TreeListItem presenter = mock(TreeListItem.class); itemView.init(presenter); checkbox.checked = true; itemView.onCheckboxChanged(null); verify(presenter).setIsSelected(true); checkbox.checked = false; itemView.onCheckboxChanged(null); verify(presenter).setIsSelected(fal...
TreeListItemView implements TreeListItem.View { public void populate(final TreeListItem item) { checkbox.checked = item.getIsSelected(); itemDetails.textContent = item.getDescription(); addSubItems(item); setExpandVisibility(item); } @Inject TreeListItemView(final HTMLDivElement itemHeader, ...
@Test public void testPopulate() { final List<TreeListSubItem> subItems = new ArrayList<>(); final String itemDescription = "Item Description"; final TreeListItem item = mock(TreeListItem.class); when(item.getIsSelected()).thenReturn(true); when(item.getDescription()).thenReturn(itemDescription); when(item.getSubItems(...
TreeListItemView implements TreeListItem.View { void setExpandVisibility(final TreeListItem item) { if (item.getSubItems().isEmpty()) { hideElement(expand); } else { showElement(expand); } } @Inject TreeListItemView(final HTMLDivElement itemHeader, final HTMLDivElement itemsContainer, ...
@Test public void testSetExpandVisibility() { final TreeListItem item = mock(TreeListItem.class); final List<TreeListSubItem> subItems = new ArrayList<>(); when(item.getSubItems()).thenReturn(subItems); itemView.setExpandVisibility(item); verify(itemView).hideElement(expand); subItems.add(mock(TreeListSubItem.class)); ...
TreeListItemView implements TreeListItem.View { void addSubItems(final TreeListItem item) { for (final TreeListSubItem sub : item.getSubItems()) { itemsContainer.appendChild(sub.getElement()); } } @Inject TreeListItemView(final HTMLDivElement itemHeader, final HTMLDivElement itemsContainer,...
@Test public void testAddSubItems() { final TreeListItem item = mock(TreeListItem.class); final TreeListSubItem subItem1 = mock(TreeListSubItem.class); final Node element1 = mock(Node.class); when(subItem1.getElement()).thenReturn(element1); final TreeListSubItem subItem2 = mock(TreeListSubItem.class); final Node eleme...
TreeListView implements TreeList.View { @Override public void add(final TreeListItem item) { treeItemsContainer.appendChild(item.getElement()); } @Inject TreeListView(final HTMLDivElement treeItemsContainer); @Override void init(final TreeList presenter); @Override void add(final TreeListItem item); @Override void cle...
@Test public void testAdd() { final TreeListItem item = mock(TreeListItem.class); final Node element = mock(Node.class); when(item.getElement()).thenReturn(element); listView.add(item); verify(treeItemsContainer).appendChild(element); }
TreeListSubItemView implements TreeListSubItem.View { @Override public void setDescription(final String description) { this.description.textContent = description; } @Inject TreeListSubItemView(@Named("span") final HTMLElement description, @Named("span") final HTMLElement details); @Overr...
@Test public void testSetDescription() { final String text = "Description"; view.setDescription(text); assertEquals(text, description.textContent); }
TreeListSubItemView implements TreeListSubItem.View { @Override public void setDetails(final String complement) { this.details.textContent = complement; } @Inject TreeListSubItemView(@Named("span") final HTMLElement description, @Named("span") final HTMLElement details); @Override void i...
@Test public void setDetails() { final String text = "Details"; view.setDetails(text); assertEquals(text, details.textContent); }
TreeList { public void populate(final List<TreeListItem> items) { currentItems = items; refresh(); } @Inject TreeList(final View view); void populate(final List<TreeListItem> items); void refresh(); List<TreeListItem> getCurrentItems(); void clear(); Node getElement(); void clearSelection(); List<TreeListItem> getSele...
@Test public void testPopulate() { doNothing().when(treeList).refresh(); final List items = mock(List.class); treeList.populate(items); verify(treeList).refresh(); }
TreeList { public void refresh() { clear(); for (final TreeListItem item : getCurrentItems()) { item.updateView(); view.add(item); item.setOnIsSelectedChanged(this::selectionChanged); } } @Inject TreeList(final View view); void populate(final List<TreeListItem> items); void refresh(); List<TreeListItem> getCurrentItem...
@Test public void testRefresh() { treeList.refresh(); verify(treeList).clear(); verify(itemOne).updateView(); verify(itemTwo).updateView(); verify(itemThree).updateView(); verify(view).add(itemOne); verify(view).add(itemTwo); verify(view).add(itemThree); }
TreeList { public void clear() { view.clear(); } @Inject TreeList(final View view); void populate(final List<TreeListItem> items); void refresh(); List<TreeListItem> getCurrentItems(); void clear(); Node getElement(); void clearSelection(); List<TreeListItem> getSelectedItems(); void setOnSelectionChanged(final Consum...
@Test public void testClear() { treeList.clear(); verify(view).clear(); }
TreeList { public Node getElement() { return view.getElement(); } @Inject TreeList(final View view); void populate(final List<TreeListItem> items); void refresh(); List<TreeListItem> getCurrentItems(); void clear(); Node getElement(); void clearSelection(); List<TreeListItem> getSelectedItems(); void setOnSelectionCha...
@Test public void testGetElement() { final Node actual = treeList.getElement(); assertEquals(element, actual); }
TreeList { public void clearSelection() { getCurrentItems().stream().forEach(item -> item.setIsSelected(false)); } @Inject TreeList(final View view); void populate(final List<TreeListItem> items); void refresh(); List<TreeListItem> getCurrentItems(); void clear(); Node getElement(); void clearSelection(); List<TreeLis...
@Test public void testClearSelection() { treeList.clearSelection(); verify(itemOne).setIsSelected(false); verify(itemTwo).setIsSelected(false); verify(itemThree).setIsSelected(false); }
DMNPathsHelperImpl implements DMNPathsHelper { @Override public List<Path> getDMNModelsPaths(final WorkspaceProject workspaceProject) { if (workspaceProject != null) { return getPathsByWorkspaceProject(dmnQueryTerms(workspaceProject.getRootPath().toURI())); } else { return getStandalonePaths(dmnModelFilter()); } } DMNP...
@Test public void testGetDMNModelsPathsWhenWorkspaceProjectIsNull() { doTestGetPathsWhenWorkspaceProjectIsNull(workspaceProject1 -> pathsHelper.getDMNModelsPaths(null)); } @Test public void testGetDMNModelsPathsWhenWorkspaceProjectIsNotNull() { doTestGetPathsWhenWorkspaceProjectIsNotNull(workspaceProject -> pathsHelper...
TreeList { public List<TreeListItem> getSelectedItems() { return getCurrentItems().stream() .filter(item -> item.getIsSelected()) .collect(Collectors.toList()); } @Inject TreeList(final View view); void populate(final List<TreeListItem> items); void refresh(); List<TreeListItem> getCurrentItems(); void clear(); Node g...
@Test public void testGetSelectedItems() { when(itemThree.getIsSelected()).thenReturn(true); final List<TreeListItem> selectedItems = treeList.getSelectedItems(); assertTrue(selectedItems.contains(itemThree)); assertFalse(selectedItems.contains(itemOne)); assertFalse(selectedItems.contains(itemTwo)); }
TreeList { @SuppressWarnings("unused") void selectionChanged(final TreeListItem treeListItem) { callOnSelectionChanged(); } @Inject TreeList(final View view); void populate(final List<TreeListItem> items); void refresh(); List<TreeListItem> getCurrentItems(); void clear(); Node getElement(); void clearSelection(); Lis...
@Test public void testSelectionChanged() { final TreeListItem treeListItem = mock(TreeListItem.class); doNothing().when(treeList).callOnSelectionChanged(); treeList.selectionChanged(treeListItem); verify(treeList).callOnSelectionChanged(); }
TreeList { void callOnSelectionChanged() { if (!Objects.isNull(getOnSelectionChanged())) { getOnSelectionChanged().accept(getSelectedItems()); } } @Inject TreeList(final View view); void populate(final List<TreeListItem> items); void refresh(); List<TreeListItem> getCurrentItems(); void clear(); Node getElement(); voi...
@Test public void testCallOnSelectionChanged() { final List selectedItems = mock(List.class); final Consumer consumer = mock(Consumer.class); doReturn(consumer).when(treeList).getOnSelectionChanged(); doReturn(selectedItems).when(treeList).getSelectedItems(); treeList.callOnSelectionChanged(); verify(consumer).accept(s...
TreeListSubItem { public Node getElement() { return view.getElement(); } @Inject TreeListSubItem(final View view); String getDescription(); void setDescription(final String description); String getDetails(); void setDetails(final String details); Node getElement(); }
@Test public void testGetElement() { final Node actual = subItem.getElement(); assertEquals(element, actual); }
TreeListItem { @PostConstruct void setup() { view.init(this); } @Inject TreeListItem(final View view); Node getElement(); String getDescription(); void setDescription(final String description); void addSubItem(final TreeListSubItem subItem); List<TreeListSubItem> getSubItems(); void updateView(); void setIsSelected(fi...
@Test public void testSetup() { treeListItem.setup(); verify(view).init(treeListItem); }
TreeListItem { public Node getElement() { return view.getElement(); } @Inject TreeListItem(final View view); Node getElement(); String getDescription(); void setDescription(final String description); void addSubItem(final TreeListSubItem subItem); List<TreeListSubItem> getSubItems(); void updateView(); void setIsSelec...
@Test public void testGetElement() { final Node actual = treeListItem.getElement(); assertEquals(viewElement, actual); }
TreeListItem { public void addSubItem(final TreeListSubItem subItem) { subItems.add(subItem); } @Inject TreeListItem(final View view); Node getElement(); String getDescription(); void setDescription(final String description); void addSubItem(final TreeListSubItem subItem); List<TreeListSubItem> getSubItems(); void upd...
@Test public void testAddSubItem() { final TreeListSubItem subItem = mock(TreeListSubItem.class); treeListItem.addSubItem(subItem); }
TreeListItem { public void updateView() { this.view.populate(this); } @Inject TreeListItem(final View view); Node getElement(); String getDescription(); void setDescription(final String description); void addSubItem(final TreeListSubItem subItem); List<TreeListSubItem> getSubItems(); void updateView(); void setIsSelec...
@Test public void testUpdateView() { treeListItem.updateView(); verify(view).populate(treeListItem); }
TreeListItem { void callOnIsSelectedChanged() { if (!Objects.isNull(getOnIsSelectedChanged())) { getOnIsSelectedChanged().accept(this); } } @Inject TreeListItem(final View view); Node getElement(); String getDescription(); void setDescription(final String description); void addSubItem(final TreeListSubItem subItem); L...
@Test public void testCallOnIsSelectedChanged() { final Consumer consumer = mock(Consumer.class); doReturn(consumer).when(treeListItem).getOnIsSelectedChanged(); treeListItem.callOnIsSelectedChanged(); verify(consumer).accept(treeListItem); }
DataTypeManagerStackStore { public List<String> get(final String uuid) { return Optional.ofNullable(typeStack.get(uuid)).orElse(new ArrayList<>()); } List<String> get(final String uuid); void put(final String uuid, final List<String> types); void clear(); }
@Test public void testGetWhenTypeStackHasTheUUID() { assertEquals(types, typeStack.get(uuid)); } @Test public void testGetWhenTypeStackDoesNotHaveTheUUID() { final List<Object> expectedTypes = emptyList(); final List<String> actualTypes = typeStack.get("otherUUID"); assertEquals(expectedTypes, actualTypes); }
DataTypeManagerStackStore { public void put(final String uuid, final List<String> types) { typeStack.put(uuid, types); } List<String> get(final String uuid); void put(final String uuid, final List<String> types); void clear(); }
@Test public void testPut() { final String uuid = "456"; final List<String> expectedTypes = asList("tCompany", "tPerson"); typeStack.put(uuid, expectedTypes); final List<String> actualTypes = typeStack.get(uuid); assertEquals(expectedTypes, actualTypes); }
DataTypeManagerStackStore { public void clear() { typeStack.clear(); } List<String> get(final String uuid); void put(final String uuid, final List<String> types); void clear(); }
@Test public void testClear() { typeStack.clear(); assertEquals(0, typeStack.size()); }
HiddenHelper { public static void hide(final Element element) { element.classList.add(HIDDEN_CSS_CLASS); } static void hide(final Element element); static void show(final Element element); static boolean isHidden(final Element element); static final String HIDDEN_CSS_CLASS; }
@Test public void testHide() { final Element element = mock(Element.class); final DOMTokenList classList = mock(DOMTokenList.class); element.classList = classList; HiddenHelper.hide(element); verify(classList).add(HIDDEN_CSS_CLASS); }
HiddenHelper { public static void show(final Element element) { element.classList.remove(HIDDEN_CSS_CLASS); } static void hide(final Element element); static void show(final Element element); static boolean isHidden(final Element element); static final String HIDDEN_CSS_CLASS; }
@Test public void testShow() { final Element element = mock(Element.class); final DOMTokenList classList = mock(DOMTokenList.class); element.classList = classList; HiddenHelper.show(element); verify(classList).remove(HIDDEN_CSS_CLASS); }
HiddenHelper { public static boolean isHidden(final Element element) { return element.classList.contains(HIDDEN_CSS_CLASS); } static void hide(final Element element); static void show(final Element element); static boolean isHidden(final Element element); static final String HIDDEN_CSS_CLASS; }
@Test public void testIsHiddenWhenElementIsHidden() { final Element element = mock(Element.class); final DOMTokenList classList = mock(DOMTokenList.class); element.classList = classList; when(classList.contains(HIDDEN_CSS_CLASS)).thenReturn(true); assertTrue(HiddenHelper.isHidden(element)); } @Test public void testIsHi...
ItemDefinitionUtils { public Optional<ItemDefinition> findByName(final String name) { return all() .stream() .filter(itemDefinition -> itemDefinition.getName().getValue().equals(name)) .findFirst(); } @Inject ItemDefinitionUtils(final DMNGraphUtils dmnGraphUtils); Optional<ItemDefinition> findByName(final String name)...
@Test public void testFindByName() { final String name = "item1"; final ItemDefinition item1 = makeItem("item1"); final ItemDefinition item2 = makeItem("item2"); final Definitions definitions = mock(Definitions.class); final List<ItemDefinition> itemDefinitions = asList(item1, item2); when(dmnGraphUtils.getModelDefinit...
ItemDefinitionUtils { public void addItemDefinitions(final List<ItemDefinition> newItemDefinitions) { final List<ItemDefinition> itemDefinitions = dmnGraphUtils.getModelDefinitions().getItemDefinition(); itemDefinitions.addAll(newItemDefinitions); } @Inject ItemDefinitionUtils(final DMNGraphUtils dmnGraphUtils); Optio...
@Test public void testAddItemDefinitions() { final Definitions definitions = mock(Definitions.class); final ItemDefinition itemDefinition1 = mock(ItemDefinition.class); final ItemDefinition itemDefinition2 = mock(ItemDefinition.class); final ItemDefinition itemDefinition3 = mock(ItemDefinition.class); final ItemDefinit...
ItemDefinitionUtils { Optional<String> getPrefixForNamespaceURI(final String namespace) { final Definitions definitions = dmnGraphUtils.getModelDefinitions(); return definitions == null ? Optional.empty() : definitions.getPrefixForNamespaceURI(namespace); } @Inject ItemDefinitionUtils(final DMNGraphUtils dmnGraphUtils...
@Test public void testGetPrefixForNamespaceURIWhenDefinitionsIsNull() { final String namespaceURI = FEEL.getUri(); when(dmnGraphUtils.getModelDefinitions()).thenReturn(null); final Optional<String> prefix = utils.getPrefixForNamespaceURI(namespaceURI); assertFalse(prefix.isPresent()); } @Test public void testGetPrefixF...
BindingPropertyConverter { public static Binding wbFromDMN(final org.kie.dmn.model.api.Binding dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { if (dmn == null) { return null; } final InformationItem convertedParameter = InformationItemPropertyConverter.wbFromDMN(dmn.getParameter()); fina...
@Test public void testWBFromDMN() { final org.kie.dmn.model.api.Binding dmn = new TBinding(); final org.kie.dmn.model.api.InformationItem informationItem = new TInformationItem(); dmn.setParameter(informationItem); final org.kie.dmn.model.api.LiteralExpression literalExpression = new TLiteralExpression(); literalExpres...
ItemDefinitionUtils { public String getConstraintText(final ItemDefinition itemDefinition) { return Optional .ofNullable(itemDefinition.getAllowedValues()) .map(UnaryTests::getText) .orElse(new Text()) .getValue(); } @Inject ItemDefinitionUtils(final DMNGraphUtils dmnGraphUtils); Optional<ItemDefinition> findByName(fi...
@Test public void testGetConstraintTextWhenItemDefinitionDoesNotHaveAllowedValues() { final ItemDefinition itemDefinition = mock(ItemDefinition.class); final String expectedText = ""; final String actualText = utils.getConstraintText(itemDefinition); assertEquals(expectedText, actualText); } @Test public void testGetCo...
DataTypeNameIsDefaultTypeMessage extends ErrorMessage { @Override String getStrongMessage(final DataType dataType) { return translationService.format(DataTypeNameIsDefaultTypeMessage_StrongMessage); } @Inject DataTypeNameIsDefaultTypeMessage(final TranslationService translationService); }
@Test public void testGetStrongMessage() { final DataType dataType = mock(DataType.class); final String expectedErrorMessage = "*Expected strong message.*"; final DataTypeNameIsDefaultTypeMessage errorMessage = new DataTypeNameIsDefaultTypeMessage(translationService); when(translationService.format(DataTypeNameIsDefaul...
DataTypeNameIsDefaultTypeMessage extends ErrorMessage { @Override String getRegularMessage() { return translationService.format(DataTypeNameIsDefaultTypeMessage_RegularMessage); } @Inject DataTypeNameIsDefaultTypeMessage(final TranslationService translationService); }
@Test public void testGetRegularMessage() { final String expectedErrorMessage = "Expected regular message."; final DataTypeNameIsDefaultTypeMessage errorMessage = new DataTypeNameIsDefaultTypeMessage(translationService); when(translationService.format(DataTypeNameIsDefaultTypeMessage_RegularMessage)).thenReturn(expecte...
ErrorMessage { public FlashMessage getFlashMessage(final DataType dataType) { return new FlashMessage(ERROR, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType)); } ErrorMessage(final TranslationService translationService); FlashMessage getFlashMessage(final DataType dataType); }
@Test public void testGetFlashMessage() { final String uuid = "uuid"; final FlashMessage.Type expectedType = ERROR; final String expectedStrongMessage = "expectedStrongMessage"; final String expectedRegularMessage = "expectedRegularMessage"; final String expectedErrorElementSelector = "[data-row-uuid=\"uuid\"] [data-ty...
DataTypeNameIsInvalidErrorMessage extends ErrorMessage { @Override String getStrongMessage(final DataType dataType) { return translationService.format(DataTypeNameIsInvalidErrorMessage_StrongMessage); } @Inject DataTypeNameIsInvalidErrorMessage(final TranslationService translationService); }
@Test public void testGetStrongMessage() { final DataType dataType = mock(DataType.class); final String expectedErrorMessage = "*Expected strong message.*"; final DataTypeNameIsInvalidErrorMessage errorMessage = new DataTypeNameIsInvalidErrorMessage(translationService); when(translationService.format(DataTypeNameIsInva...
DataTypeNameIsInvalidErrorMessage extends ErrorMessage { @Override String getRegularMessage() { return translationService.format(DataTypeNameIsInvalidErrorMessage_RegularMessage); } @Inject DataTypeNameIsInvalidErrorMessage(final TranslationService translationService); }
@Test public void testGetRegularMessage() { final String expectedErrorMessage = "Expected regular message."; final DataTypeNameIsInvalidErrorMessage errorMessage = new DataTypeNameIsInvalidErrorMessage(translationService); when(translationService.format(DataTypeNameIsInvalidErrorMessage_RegularMessage)).thenReturn(expe...
DataTypeNameIsBlankErrorMessage extends ErrorMessage { @Override String getStrongMessage(final DataType dataType) { return translationService.format(DataTypeNameIsBlankErrorMessage_StrongMessage); } @Inject DataTypeNameIsBlankErrorMessage(final TranslationService translationService); }
@Test public void testGetStrongMessage() { final DataType dataType = mock(DataType.class); final String expectedErrorMessage = "*Expected strong message.*"; final DataTypeNameIsBlankErrorMessage errorMessage = new DataTypeNameIsBlankErrorMessage(translationService); when(translationService.format(DataTypeNameIsBlankErr...
BindingPropertyConverter { public static org.kie.dmn.model.api.Binding dmnFromWB(final Binding wb, final Consumer<ComponentWidths> componentWidthsConsumer) { if (wb == null) { return null; } final org.kie.dmn.model.api.Binding result = new org.kie.dmn.model.v1_2.TBinding(); final org.kie.dmn.model.api.InformationItem c...
@Test public void testDMNFromWB() { final Binding wb = new Binding(); final InformationItem informationItem = new InformationItem(); wb.setParameter(informationItem); final LiteralExpression literalExpression = new LiteralExpression(); literalExpression.getComponentWidths().set(0, 200.0); literalExpression.getId().setV...
DataTypeNameIsBlankErrorMessage extends ErrorMessage { @Override String getRegularMessage() { return translationService.format(DataTypeNameIsBlankErrorMessage_RegularMessage); } @Inject DataTypeNameIsBlankErrorMessage(final TranslationService translationService); }
@Test public void testGetRegularMessage() { final String expectedErrorMessage = "Expected regular message."; final DataTypeNameIsBlankErrorMessage errorMessage = new DataTypeNameIsBlankErrorMessage(translationService); when(translationService.format(DataTypeNameIsBlankErrorMessage_RegularMessage)).thenReturn(expectedEr...
DataTypeNameIsNotUniqueErrorMessage extends ErrorMessage { @Override String getStrongMessage(final DataType dataType) { return translationService.format(DataTypeNameIsNotUniqueErrorMessage_StrongMessage, dataType.getName()); } @Inject DataTypeNameIsNotUniqueErrorMessage(final TranslationService translationService); ...
@Test public void testGetStrongMessage() { final DataType dataType = mock(DataType.class); final String dataTypeName = "name"; final String expectedErrorMessage = "*Expected strong message.*"; final DataTypeNameIsNotUniqueErrorMessage errorMessage = new DataTypeNameIsNotUniqueErrorMessage(translationService); when(data...
DataTypeNameIsNotUniqueErrorMessage extends ErrorMessage { @Override String getRegularMessage() { return translationService.format(DataTypeNameIsNotUniqueErrorMessage_RegularMessage); } @Inject DataTypeNameIsNotUniqueErrorMessage(final TranslationService translationService); }
@Test public void testGetRegularMessage() { final String expectedErrorMessage = "Expected regular message."; final DataTypeNameIsNotUniqueErrorMessage errorMessage = new DataTypeNameIsNotUniqueErrorMessage(translationService); when(translationService.format(DataTypeNameIsNotUniqueErrorMessage_RegularMessage)).thenRetur...
ScrollHelper { public void scrollToBottom(final Element element) { scrollTo(element, element); } void animatedScrollToBottom(final Element element); void scrollToBottom(final Element element); void scrollTo(final Element target, final Element container, final int paddi...
@Test public void testScrollToBottom() { final Element element = mock(Element.class); doNothing().when(scrollHelper).scrollTo(element, element); scrollHelper.scrollToBottom(element); verify(scrollHelper).scrollTo(element, element); }
ScrollHelper { public void scrollTo(final Element target, final Element container, final int padding) { final double targetOffsetTop = ((HTMLElement) target).offsetTop; final double containerOffsetTop = ((HTMLElement) container).offsetTop; container.scrollTop = targetOffsetTop - containerOffsetTop - padding; } void an...
@Test public void testScrollToWithTwoArguments() { final Element target = mock(Element.class); final Element container = mock(Element.class); doNothing().when(scrollHelper).scrollTo(any(), any(), anyInt()); scrollHelper.scrollTo(target, container); verify(scrollHelper).scrollTo(target, container, 0); } @Test public voi...
ScrollHelper { public void animatedScrollToBottom(final Element element) { animatedScrollToBottom(element, element.scrollHeight); } void animatedScrollToBottom(final Element element); void scrollToBottom(final Element element); void scrollTo(final Element target, final Element container, ...
@Test public void testAnimatedScrollToBottomWithOneArgument() { final Element element = mock(Element.class); final int scrollHeight = 123; element.scrollHeight = scrollHeight; doNothing().when(scrollHelper).animatedScrollToBottom(any(), anyDouble()); scrollHelper.animatedScrollToBottom(element); verify(scrollHelper).an...
DataTypeUtils { public List<DataType> defaultDataTypes() { return Stream .of(BuiltInType.values()) .filter(builtInType -> !builtInType.equals(BuiltInType.UNDEFINED)) .map(bit -> dataTypeManager.from(bit).get()) .sorted(Comparator.comparing(DataType::getType)) .collect(toList()); } @Inject DataTypeUtils(final DataTypeS...
@Test public void testDefaultDataTypes() { final List<DataType> dataTypes = utils.defaultDataTypes(); assertEquals(10, dataTypes.size()); assertEquals("Any", dataTypes.get(0).getType()); assertEquals("boolean", dataTypes.get(1).getType()); assertEquals("context", dataTypes.get(2).getType()); assertEquals("date", dataTy...
DataTypeUtils { public List<DataType> customDataTypes() { return dataTypeStore .getTopLevelDataTypes() .stream() .sorted(Comparator.comparing(DataType::getName)) .collect(Collectors.toList()); } @Inject DataTypeUtils(final DataTypeStore dataTypeStore, final DataTypeManager dataTypeManager); Da...
@Test public void testCustomDataTypes() { final DataType dataType1 = mock(DataType.class); final DataType dataType2 = mock(DataType.class); final List<DataType> unorderedDataTypes = asList(dataType1, dataType2); final List<DataType> expectedDataTypes = asList(dataType2, dataType1); when(dataTypeStore.getTopLevelDataTyp...
DataTypeUtils { public DataType getTopLevelParent(final DataType dataType) { final String parentUUID = dataType.getParentUUID(); final Optional<DataType> parent = Optional.ofNullable(dataTypeStore.get(parentUUID)); return parent.map(this::getTopLevelParent).orElse(dataType); } @Inject DataTypeUtils(final DataTypeStore...
@Test public void testGetTopLevelParent() { final DataType dataType1 = mock(DataType.class); final DataType dataType2 = mock(DataType.class); final DataType dataType3 = mock(DataType.class); final String uuid1 = "0000"; final String uuid2 = "1111"; final String uuid3 = "2222"; when(dataType1.getUUID()).thenReturn(uuid1...
ExpressionLanguagePropertyConverter { public static ExpressionLanguage wbFromDMN(final String language) { if (language == null) { return new ExpressionLanguage(""); } else { return new ExpressionLanguage(language); } } static ExpressionLanguage wbFromDMN(final String language); static String dmnFromWB(final Expression...
@Test public void testWBFromDMNWithNullValue() { assertEquals("", ExpressionLanguagePropertyConverter.wbFromDMN(null).getValue()); } @Test public void testWBFromDMNWithNonNullValue() { assertEquals(EXPRESSION_LANGUAGE, ExpressionLanguagePropertyConverter.wbFromDMN(EXPRESSION_LANGUAGE).getValue()); }
DataTypeManager { public DataTypeManager withConstraintType(final String constraintType) { dataType.setConstraintType(ConstraintType.fromString(constraintType)); return this; } @Inject DataTypeManager(final TranslationService translationService, final ItemDefinitionRecordEngine recordEngine,...
@Test public void testWithConstraintType() { final ConstraintType expectedConstraintType = ConstraintType.ENUMERATION; final DataType dataType = manager.from(makeDataType("uuid")).withConstraintType(expectedConstraintType.value()).get(); final ConstraintType actualConstraintType = dataType.getConstraintType(); assertEq...
DataTypeManager { public DataTypeManager withParentUUID(final String parentUUID) { dataType.setParentUUID(parentUUID); return this; } @Inject DataTypeManager(final TranslationService translationService, final ItemDefinitionRecordEngine recordEngine, final ItemDefin...
@Test public void testWithParentUUID() { final String expectedParentUUID = "expectedParentUUID"; final DataType dataType = manager.from(makeDataType("uuid")).withParentUUID(expectedParentUUID).get(); final String actualParentUUID = dataType.getParentUUID(); assertEquals(expectedParentUUID, actualParentUUID); }
DataTypeManager { public DataTypeManager withName(final String name) { dataType.setName(name); return this; } @Inject DataTypeManager(final TranslationService translationService, final ItemDefinitionRecordEngine recordEngine, final ItemDefinitionStore itemDefinitio...
@Test public void testWithName() { final String expectedName = "expectedName"; final DataType dataType = manager.from(makeDataType("uuid")).withName(expectedName).get(); final String actualName = dataType.getName(); assertEquals(expectedName, actualName); }
DataTypeManager { public DataTypeManager withNoName() { return withName(none()); } @Inject DataTypeManager(final TranslationService translationService, final ItemDefinitionRecordEngine recordEngine, final ItemDefinitionStore itemDefinitionStore, ...
@Test public void testWithNoName() { final String expectedName = NONE; final DataType dataType = manager.from(makeDataType("uuid")).withNoName().get(); final String actualName = dataType.getName(); assertEquals(expectedName, actualName); }