MCTMutableTreeNode extends DefaultMutableTreeNode { @Override public void removeAllChildren() { for (int i = super.getChildCount() - 1; i >= 0; i--) { remove(i); } } MCTMutableTreeNode();  MCTMutableTreeNode(JComponent userObject);  MCTMutableTreeNode(JComponent userObject, JTree parentTree);  MCTMutableTreeNode(JComponent userObject, boolean allowsChildren);  MCTMutableTreeNode(JComponent userObject, JTree parentTree, boolean allowsChildren); @Override void add(MutableTreeNode newChild); void setProxy(boolean isProxy); boolean isProxy(); boolean isVisible(); @Override TreeNode getChildAt(int index); @Override int getChildCount(); @Override void removeAllChildren(); void removeAllChildren(PropertyChangeListener listener); JTree getParentTree(); void setParentTree(JTree parentTree); void addChild(int index, MCTMutableTreeNode newNode, PropertyChangeListener listener); void refresh(MCTMutableTreeNode childNode); void refresh(); void removeChild(MCTMutableTreeNode childNode, PropertyChangeListener listener); TreePath getTreePath(); static final String PARENT_CLIENT_PROPERTY_NAME; }
@Test public void testRemoveAllChildren() { myTreeNode.removeAllChildren(); assertEquals(myTreeNode.getChildCount(), 0); }