DataSetDefFilterEditor implements IsWidget, org.dashbuilder.dataset.client.editor.DataSetDefFilterEditor { void onValueChanged(@Observes DataSetFilterChangedEvent event) { DataSetFilter before = this.value; setValue(event.getFilter()); filterChangedEvent.fire(new FilterChangedEvent(DataSetDefFilterEditor.this, before, value)); } @Inject  DataSetDefFilterEditor(View view, DataSetFilterEditor filterEditor, final Event<FilterChangedEvent> filterChangedEvent); @Override void init(DataSetMetadata metadata); @Override Widget asWidget(); @Override void flush(); @Override void onPropertyChange(final String... paths); @Override void setValue(final DataSetFilter value); @Override void setDelegate(final EditorDelegate<DataSetFilter> delegate); public View view; }
@Test public void testOnValueChanged() throws Exception { DataSetFilter filter3 = mock(DataSetFilter.class); when(filter2.cloneInstance()).thenReturn(filter3); tested.value = filter1; tested.onValueChanged(new DataSetFilterChangedEvent(filter2)); assertEquals(filter3, tested.value); verify(view, never()).setWidget(any(IsWidget.class)); verify(dataSetFilterEditor, never()).init(any(DataSetFilter.class), any(DataSetMetadata.class)); verify(filterChangedEvent).fire(any(FilterChangedEvent.class)); }