### Question:
HierarchicalName { @Override public String toString() { StringBuilder sb = new StringBuilder(); if (m_is_absolute) { sb.append("::"); } for (int i = 0; i < m_names.size(); i++) { if (i > 0) { sb.append("::"); } sb.append(m_names.get(i)); } return sb.toString(); } HierarchicalName(boolean absolute, List<String> names);  HierarchicalName(boolean absolute, String... names); boolean absolute(); String peek(); HierarchicalName pop_first(); boolean leaf(); HierarchicalName push(String name); HierarchicalName make_absolute(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void hierarchical_name_as_string() throws Exception { HierarchicalName hn1 = new HierarchicalName(true, "a"); assertEquals("::a", hn1.toString()); HierarchicalName hn2 = new HierarchicalName(true, "a", "b"); assertEquals("::a::b", hn2.toString()); HierarchicalName hn3 = new HierarchicalName(false, "a"); assertEquals("a", hn3.toString()); HierarchicalName hn4 = new HierarchicalName(false, "a", "b"); assertEquals("a::b", hn4.toString()); }