@Test void traversesBreadthFirst() {
    Span.Builder builder = Span.newBuilder().traceId("a");
    SpanNode a = new SpanNode(builder.id("a").build());
    SpanNode b = new SpanNode(builder.id("b").build());
    SpanNode c = new SpanNode(builder.id("c").build());
    SpanNode d = new SpanNode(builder.id("d").build());
    // root(a) has children b, c, d
    a.addChild(b).addChild(c).addChild(d);
    SpanNode e = new SpanNode(builder.id("e").build());
    SpanNode f = new SpanNode(builder.id("f").build());
    SpanNode g = new SpanNode(builder.id("1").build());
    // child(b) has children e, f, g
    b.addChild(e).addChild(f).addChild(g);
    SpanNode h = new SpanNode(builder.id("2").build());
    // f has no children
    // child(g) has child h
    g.addChild(h);

    assertThat(a.traverse()).toIterable()
      .extracting(SpanNode::span)
      .extracting(s -> s.id().replaceAll("0", ""))
      .containsExactly("a", "b", "c", "d", "e", "f", "1", "2");
  }
The following tree should traverse in alphabetical order

<p><pre>{@code
         a
       / | \
      b  c  d
     /|\
    e f g
         \
          h
}</pre>
zipkin/src/test/java/zipkin2/internal/SpanNodeTest.java