DataSetDefRefreshIntervalEditor implements IsWidget, org.dashbuilder.dataset.client.editor.DataSetDefRefreshIntervalEditor { @Override public String getValue() { final Double quantity = view.getQuantity(); final DateIntervalType type = getSelectedIntervalType(); return new TimeAmount(quantity.longValue(), type).toString(); } @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 testGetValue() { when(view.getQuantity()).thenReturn(1d); when(view.getSelectedIntervalTypeIndex()).thenReturn(0); final String value = presenter.getValue(); assertEquals("1 second", value); verify(view, times(1)).getQuantity(); verify(view, times(1)).getSelectedIntervalTypeIndex(); verify(view, times(0)).setQuantity(10d); verify(view, times(0)).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()); }