DataSetDefRefreshIntervalEditor implements IsWidget, org.dashbuilder.dataset.client.editor.DataSetDefRefreshIntervalEditor { @Override public void setValue(final String value) { double quantity = 1; int index = -1; if (value != null) { final TimeAmount timeAmount = TimeAmount.parse(value); quantity = timeAmount.getQuantity(); final DateIntervalType dType = timeAmount.getType(); index = getIntervalTypeIndex(dType); } view.setQuantity(quantity); view.setSelectedIntervalType(index > -1 ? index : getIntervalTypeIndex(DEFAULT_INTERVAL_TYPE)); } @Inject  DataSetDefRefreshIntervalEditor(final View view,
                                           final Event<org.dashbuilder.common.client.event.ValueChangeEvent<String>> valueChangeEvent); @PostConstruct void init(); @Override Widget asWidget(); void addHelpContent(final String title, final String content, final Placement placement); @Override void setEnabled(final boolean isEnabled); @Override void setValue(final String value); @Override String getValue(); public View view; }
@Test public void testSetValue() { final String value = "1second"; presenter.setValue(value); verify(view, times(1)).setQuantity(1d); verify(view, times(1)).setSelectedIntervalType(anyInt()); verify(view, times(0)).setEnabled(anyBoolean()); verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(view, times(0)).init(presenter); verify(view, times(0)).addIntervalTypeItem(anyString()); verify(view, times(0)).getSelectedIntervalTypeIndex(); verify(view, times(0)).getQuantity(); }