### Question:
GTreeNode extends CoreGTreeNode implements Comparable<GTreeNode> { public GTreeNode filter(GTreeFilter filter, TaskMonitor monitor) throws CancelledException, CloneNotSupportedException { List<GTreeNode> list = new ArrayList<>(); if (isLoaded()) { for (GTreeNode child : children()) { monitor.checkCanceled(); GTreeNode filtered = child.filter(filter, monitor); if (filtered != null) { list.add(filtered); } monitor.incrementProgress(1); } } if (isRoot() || !list.isEmpty() || filter.acceptsNode(this) || getParent() == null) { GTreeNode clone = clone(); clone.doSetChildren(list); return clone; } return null; }  String getDisplayText(); abstract String getName(); abstract Icon getIcon(boolean expanded); abstract String getToolTip(); abstract boolean isLeaf(); @Override int compareTo(GTreeNode node); void addNode(GTreeNode node); void addNodes(List<GTreeNode> nodes); void addNode(int index, GTreeNode node); List<GTreeNode> getChildren(); int getChildCount(); GTreeNode getChild(String name); GTreeNode getChild(int index); int getNodeCount(); int getLeafCount(); int getIndexInParent(); int getIndexOfChild(GTreeNode node); TreePath getTreePath(); void removeAll(); void removeNode(GTreeNode node); void setChildren(List<GTreeNode> childList); boolean isAncestor(GTreeNode node); void valueChanged(Object newValue); boolean isEditable(); GTreeNode getRoot(); boolean isRoot(); GTreeNode filter(GTreeFilter filter, TaskMonitor monitor); int loadAll(TaskMonitor monitor); @Override int hashCode(); @Override boolean equals(Object obj); Stream<GTreeNode> stream(boolean depthFirst); Iterator<GTreeNode> iterator(boolean depthFirst); @Override String toString(); void fireNodeStructureChanged(GTreeNode node); void fireNodeChanged(GTreeNode parentNode, GTreeNode node); void expand(); void collapse(); boolean isExpanded();  }### Answer:
@Test public void testFilter() throws CancelledException, CloneNotSupportedException { GTreeNode filtered = root.filter(new TestFilter("0_0"), TaskMonitor.DUMMY); assertEquals(3, filtered.getNodeCount()); assertEquals(root, filtered); assertEquals(1, filtered.getChildCount()); GTreeNode node = filtered.getChild(0); assertEquals(node0, node); assertEquals(1, node.getChildCount()); assertEquals(node0_0, node.getChild(0)); }