@Test public void testRender() { final DataTypeConstraintEnumerationItem item1 = mock(DataTypeConstraintEnumerationItem.class); final DataTypeConstraintEnumerationItem item2 = mock(DataTypeConstraintEnumerationItem.class); final Element element1 = mock(Element.class); final Element element2 = mock(Element.class); final InOrder inorder = Mockito.inOrder(view); when(item1.getOrder()).thenReturn(1); when(item2.getOrder()).thenReturn(0); when(item1.getElement()).thenReturn(element1); when(item2.getElement()).thenReturn(element2); doReturn(asList(item1, item2)).when(constraintEnumeration).getEnumerationItems(); constraintEnumeration.render(); verify(constraintEnumeration).scheduleRender(scheduledCommandArgumentCaptor.capture()); scheduledCommandArgumentCaptor.getValue().execute(); verify(view).clear(); inorder.verify(view).addItem(element2); inorder.verify(view).addItem(element1); }
public void render() { scheduleRender(() -> { view.clear(); getEnumerationItems() .stream() .sorted(Comparator.comparingInt(DataTypeConstraintEnumerationItem::getOrder)) .forEach(enumerationItem -> view.addItem(enumerationItem.getElement())); }); }
DataTypeConstraintEnumeration implements DataTypeConstraintComponent { public void render() { scheduleRender(() -> { view.clear(); getEnumerationItems() .stream() .sorted(Comparator.comparingInt(DataTypeConstraintEnumerationItem::getOrder)) .forEach(enumerationItem -> view.addItem(enumerationItem.getElement())); }); } }
DataTypeConstraintEnumeration implements DataTypeConstraintComponent { public void render() { scheduleRender(() -> { view.clear(); getEnumerationItems() .stream() .sorted(Comparator.comparingInt(DataTypeConstraintEnumerationItem::getOrder)) .forEach(enumerationItem -> view.addItem(enumerationItem.getElement())); }); } @Inject  DataTypeConstraintEnumeration(final View view,
                                         final DMNClientServicesProxy clientServicesProxy,
                                         final ScrollHelper scrollHelper,
                                         final Event<DataTypeConstraintParserWarningEvent> parserWarningEvent,
                                         final ManagedInstance<DataTypeConstraintEnumerationItem> enumerationItemInstances); }
DataTypeConstraintEnumeration implements DataTypeConstraintComponent { public void render() { scheduleRender(() -> { view.clear(); getEnumerationItems() .stream() .sorted(Comparator.comparingInt(DataTypeConstraintEnumerationItem::getOrder)) .forEach(enumerationItem -> view.addItem(enumerationItem.getElement())); }); } @Inject  DataTypeConstraintEnumeration(final View view,
                                         final DMNClientServicesProxy clientServicesProxy,
                                         final ScrollHelper scrollHelper,
                                         final Event<DataTypeConstraintParserWarningEvent> parserWarningEvent,
                                         final ManagedInstance<DataTypeConstraintEnumerationItem> enumerationItemInstances); @Override String getValue(); @Override void setValue(final String value); @Override void setConstraintValueType(final String type); void refreshView(); void refreshView(final Command onCompleteCallback); @Override Element getElement(); void render(); void scrollToPosition(final int position); List<DataTypeConstraintEnumerationItem> getEnumerationItems(); }
DataTypeConstraintEnumeration implements DataTypeConstraintComponent { public void render() { scheduleRender(() -> { view.clear(); getEnumerationItems() .stream() .sorted(Comparator.comparingInt(DataTypeConstraintEnumerationItem::getOrder)) .forEach(enumerationItem -> view.addItem(enumerationItem.getElement())); }); } @Inject  DataTypeConstraintEnumeration(final View view,
                                         final DMNClientServicesProxy clientServicesProxy,
                                         final ScrollHelper scrollHelper,
                                         final Event<DataTypeConstraintParserWarningEvent> parserWarningEvent,
                                         final ManagedInstance<DataTypeConstraintEnumerationItem> enumerationItemInstances); @Override String getValue(); @Override void setValue(final String value); @Override void setConstraintValueType(final String type); void refreshView(); void refreshView(final Command onCompleteCallback); @Override Element getElement(); void render(); void scrollToPosition(final int position); List<DataTypeConstraintEnumerationItem> getEnumerationItems();  }