ValueBoxEditor implements IsWidget, LeafAttributeEditor<T> { void onValueChanged(final T value) { if (this.value != null && this.value.equals(value)) return; view.clearError(); T before = this.value; this.value = value; valueChangeEvent.fire(new org.dashbuilder.common.client.event.ValueChangeEvent<T>(this, before, this.value)); } @Inject  ValueBoxEditor(final View<T> view,
                          final Event<org.dashbuilder.common.client.event.ValueChangeEvent<T>> valueChangeEvent); @PostConstruct void init(); void addHelpContent(final String title, final String content, final Placement placement); @Override void showErrors(List<EditorError> errors); @Override Widget asWidget(); @Override void setValue(T value); @Override T getValue(); public View<T> view; }
@Test public void testOnValueChanged() throws Exception { final String newValue = "newValue"; presenter.onValueChanged(newValue); assertEquals(newValue, presenter.getValue()); verify(view, times(1)).clearError(); verify(view, times(0)).setValue(newValue); verify(view, times(0)).showError(any(SafeHtml.class)); verify(view, times(0)).init(presenter); verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class)); }