HOMERNode extends AbstractMultiLabelClassifier { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (!HIERARCHICAL_STRING) { String actualBaselearnerName = this.baselearner.getOptions()[1]; sb.append(actualBaselearnerName.substring(actualBaselearnerName.lastIndexOf('.') + 1, actualBaselearnerName.length())); sb.append("("); sb.append(this.children.stream().map(HOMERNode::toString).collect(Collectors.joining(","))); sb.append(")"); } return sb.toString(); } HOMERNode(final HOMERNode... nodes);  HOMERNode(final List<HOMERNode> nodes); void setThreshold(final boolean doThreshold); void setBaselearner(final MultiLabelClassifier baselearner); String getBaselearnerName(); void setBaselearnerName(final String baselearnerName); List<HOMERNode> getChildren(); Collection<Integer> getLabels(); @Override void buildClassifier(final Instances trainingSet); @Override double[] distributionForInstance(final Instance testInstance); Instances prepareInstances(final Instances dataset); boolean isLeaf(); @Override String toString();  }
@Test public void testToString() { assertEquals("toString is not giving the correct result.", "J48(J48(1,2),5,7)", node.toString()); }