### Question:
DecisionTree implements TreeBasedClassifier { @Override public String toString() { StringBuilder result = new StringBuilder(); if (root != null) { Deque<Pair<TreeNode,TreePath>> toPrint = new LinkedList<>(); toPrint.push(new Pair<>(root, TreePath.EMPTY)); while (!toPrint.isEmpty()) { Pair<TreeNode,TreePath> entry = toPrint.pop(); TreeNode node = entry.getFirst(); TreePath path = entry.getSecond(); int pathLength = path.length(); for (int i = 0; i < pathLength; i++) { if (i == pathLength - 1) { result.append(" +-"); } else { result.append(path.isLeftAt(i) ? " | " : " "); } } result.append(node).append('\n'); if (node != null && !node.isTerminal()) { DecisionNode decisionNode = (DecisionNode) node; toPrint.push(new Pair<>(decisionNode.getRight(), path.extendRight())); toPrint.push(new Pair<>(decisionNode.getLeft(), path.extendLeft())); } } } return result.toString(); } DecisionTree(TreeNode root); @Override Prediction predict(Example test); TerminalNode findTerminal(Example example); TreeNode findByID(String id); @Override void update(Example train); @Override String toString();  }### Answer:
@Test public void testToString() { String s = buildTestTree().toString(); assertTrue(s.startsWith("(#0 >= 1.0)")); assertContains(s, "(#0 >= -1.0)"); }