ActiveFiltersViewImpl implements ActiveFiltersView { @Override public <T extends Object> void removeActiveFilter(final ActiveFilterItem<T> filter) { activeFiltersList.getModel().removeIf(f -> f.getKey().equals(filter.getKey())); }  @PostConstruct void init(); @PreDestroy void destroy(); @Override void setSaveFilterCallback(final ParameterizedCommand<String> callback); @Override void setRemoveAllFilterCallback(final Command callback); @Override void closeSaveFilter(); @Override void setSaveFilterErrorMessage(final String message); @Override void addActiveFilter(final ActiveFilterItem<T> filter); void onRemoveActiveFilter(@Observes final ActiveFilterItemRemovedEvent event); @Override void removeActiveFilter(final ActiveFilterItem<T> filter); @EventHandler("remove-all-filters") void onRemoveAll(@ForEvent("click") Event e); @EventHandler("save-filter") void onSaveFilter(@ForEvent("click") Event e); @Override void removeAllActiveFilters(final Boolean useCallback); @Override HTMLElement getElement();  }
@Test public void testRemoveActiveFilter(){ final List<ActiveFilterItem> model = new ArrayList<>(); when(activeFiltersList.getModel()).thenReturn(model); model.add(new ActiveFilterItem<>("key1", null, null, null, null)); model.add(new ActiveFilterItem<>("key2", null, null, null, null)); view.removeActiveFilter(new ActiveFilterItem<>("key1", null, null, null, null)); view.removeActiveFilter(new ActiveFilterItem<>("key3", null, null, null, null)); assertEquals(1, model.size()); verify(activeFiltersList, times(2)).getModel(); }