TreeDataProvider extends AbstractHierarchicalDataProvider<T, SerializablePredicate<T>> implements InMemoryDataProvider<T> { @Override public void setFilter(SerializablePredicate<T> filter) { this.filter = filter; refreshAll(); } TreeDataProvider(TreeData<T> treeData); TreeData<T> getTreeData(); @Override boolean hasChildren(T item); @Override int getChildCount(
            HierarchicalQuery<T, SerializablePredicate<T>> query); @Override Stream<T> fetchChildren(
            HierarchicalQuery<T, SerializablePredicate<T>> query); @Override SerializablePredicate<T> getFilter(); @Override void setFilter(SerializablePredicate<T> filter); @Override SerializableComparator<T> getSortComparator(); @Override void setSortComparator(SerializableComparator<T> comparator);  }
@Test public void setFilter() { getDataProvider().setFilter(item -> item.getValue().equals("Xyz") || item.getValue().equals("Baz")); assertEquals(10, sizeWithUnfilteredQuery()); getDataProvider().setFilter(item -> !item.getValue().equals("Foo") && !item.getValue().equals("Xyz")); assertEquals( "Previous filter should be replaced when setting a new one", 14, sizeWithUnfilteredQuery()); getDataProvider().setFilter(null); assertEquals("Setting filter to null should remove all filters", 20, sizeWithUnfilteredQuery()); }