DataSetFilterEditor implements IsWidget { public void init(DataSetFilter filter, DataSetMetadata metadata) { this.filter = filter; this.metadata = metadata; view.showNewFilterHome(); view.clearColumnSelector(); if (metadata != null) { for (int i = 0; i < metadata.getNumberOfColumns(); i++) { view.addColumn(metadata.getColumnId(i)); } } view.clearColumnFilterEditors(); if (filter != null) { for (ColumnFilter columnFilter : filter.getColumnFilterList()) { ColumnFilterEditor columnFilterEditor = beanManager.lookupBean(ColumnFilterEditor.class).newInstance(); columnFilterEditor.init(metadata, columnFilter); view.addColumnFilterEditor(columnFilterEditor); } } } @Inject  DataSetFilterEditor(View view,
                               SyncBeanManager beanManager,
                               Event<DataSetFilterChangedEvent> changeEvent); @Override Widget asWidget(); DataSetFilter getFilter(); void init(DataSetFilter filter, DataSetMetadata metadata); void onNewFilterStart(); void onNewFilterCancel(); void onCreateFilter();  }
@Test public void testViewInitialization() { DataSetFilter filter = new DataSetFilter(); ColumnFilter filter1 = FilterFactory.equalsTo("column1", "Test"); filter.addFilterColumn(filter1); DataSetFilterEditor filterEditor = new DataSetFilterEditor(filterView, beanManager, changedEvent); filterEditor.init(filter, metadata); assertEquals(filterView, filterEditor.view); verify(filterView).showNewFilterHome(); verify(filterView).addColumn("column1"); verify(filterView).addColumn("column2"); verify(filterView).addColumn("column3"); verify(filterView, times(filter.getColumnFilterList().size())).addColumnFilterEditor(any(ColumnFilterEditor.class)); }