### Question:
Trees extends Static { public static String toString(final TreeModel tree) { final TreeFormat tf = new TreeFormat(); tf.setTableFormatEnabled(true); final StringBuilder buffer = new StringBuilder(); tf.format(tree, buffer); return buffer.toString(); } private  Trees(); static Object getUserObject(final TreeNode node); static TreePath[] getPathsToUserObject(final TreeModel model, final Object value); static MutableTreeNode objectToSwing(final Object object); static MutableTreeNode xmlToSwing(final Node node); static MutableTreeNode copy(final TreeNode node); static MutableTreeNode copy(final TreeNode node, final TreeNodeFilter filter); static String toString(final TreeModel tree); static String toString(final TreeNode node);  }### Answer:
@Test public void testToString() { final NamedTreeNode root = new NamedTreeNode("Node #1", 1); final NamedTreeNode branch = new NamedTreeNode("Node #2", 2); root.add(branch); root.add(new NamedTreeNode("Node #3", 3)); branch.add(new NamedTreeNode("Node #4", 4)); assertEquals(Integer.valueOf(1), root.getUserObject()); assertEquals(Integer.valueOf(2), branch.getUserObject()); assertMultilinesEquals( "Node #1\n" + "├───Node #2\n" + "│ └───Node #4\n" + "└───Node #3\n", Trees.toString(root)); }
@Test public void testLocalized() { final LocalizedTreeNode root = new LocalizedTreeNode(Vocabulary.formatInternational(Vocabulary.Keys.Undefined)); final NamedTreeNode child = new NamedTreeNode(Vocabulary.formatInternational(Vocabulary.Keys.Unknown)); root.add(child); root.locale = Locale.ENGLISH; assertEquals("Undefined", root.toString()); assertEquals("Unknown", child.toString()); root.locale = Locale.FRENCH; assertEquals("Indéfini", root.toString()); assertEquals("Inconnu", child.toString()); }