@Override public void execute(double time) { final SortedSet<PrioritizedCommand> clone = commands; commands = new TreeSet<PrioritizedCommand>(COMPARATOR); if (!clone.isEmpty()) { final Iterator<PrioritizedCommand> itr = clone.iterator(); while (itr.hasNext()) { final PrioritizedCommand command = itr.next(); command.execute(); } } } };
@Before public void setup() { when(listBox.getElement()).thenReturn(listBoxElement); when(listBoxElement.getStyle()).thenReturn(mock(Style.class)); when(domElementContainer.iterator()).thenReturn(Collections.<Widget>emptyList().iterator()); when(gridLayer.getDomElementContainer()).thenReturn(domElementContainer); when(gridWidget.getModel()).thenReturn(new BaseGridData()); doAnswer((i) -> { final PrioritizedCommand command = (PrioritizedCommand) i.getArguments()[0]; command.execute(); return null; }).when(gridLayer).batch(any(PrioritizedCommand.class)); factory = spy(new ListBoxSingletonDOMElementFactoryMock(gridLienzoPanel, gridLayer, gridWidget)); }
@Override public int compare(final PrioritizedCommand o1, final PrioritizedCommand o2) { return o1.getPriority() - o2.getPriority(); } };
@Override public void execute(double time) { final SortedSet<PrioritizedCommand> clone = commands; commands = new TreeSet<PrioritizedCommand>(COMPARATOR); if (!clone.isEmpty()) { final Iterator<PrioritizedCommand> itr = clone.iterator(); while (itr.hasNext()) { final PrioritizedCommand command = itr.next(); command.execute(); } } } };
@Override public int compare(final PrioritizedCommand o1, final PrioritizedCommand o2) { return o1.getPriority() - o2.getPriority(); } };