@Test protected void intermediateSpans(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    String traceId = newTraceId();

    Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
    Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
    Endpoint db = suffixServiceName(TestObjects.DB, testSuffix);

    List<Span> trace = List.of(
      Span.newBuilder().traceId(traceId).id("20").name("get")
        .timestamp(TODAY * 1000L).duration(350L * 1000L)
        .kind(Kind.SERVER)
        .localEndpoint(frontend).build(),
      Span.newBuilder().traceId(traceId).parentId("20").id("21").name("call")
        .timestamp((TODAY + 25) * 1000L).duration(325L * 1000L)
        .localEndpoint(frontend).build(),
      Span.newBuilder().traceId(traceId).parentId("21").id("22").name("get")
        .timestamp((TODAY + 50) * 1000L).duration(250L * 1000L)
        .kind(Kind.CLIENT)
        .localEndpoint(frontend).build(),
      Span.newBuilder().traceId(traceId).parentId("21").id("22").name("get")
        .timestamp((TODAY + 100) * 1000L).duration(150 * 1000L).shared(true)
        .kind(Kind.SERVER)
        .localEndpoint(backend).build(),
      Span.newBuilder().traceId(traceId).parentId("22").id(23L).name("call")
        .timestamp((TODAY + 110) * 1000L).duration(130L * 1000L)
        .name("depth4")
        .localEndpoint(backend).build(),
      Span.newBuilder().traceId(traceId).parentId(23L).id(24L).name("call")
        .timestamp((TODAY + 125) * 1000L).duration(105L * 1000L)
        .name("depth5")
        .localEndpoint(backend).build(),
      Span.newBuilder().traceId(traceId).parentId(24L).id(25L).name("get")
        .timestamp((TODAY + 150) * 1000L).duration(50L * 1000L)
        .kind(Kind.CLIENT)
        .localEndpoint(backend)
        .remoteEndpoint(db).build()
    );

    processDependencies(trace);

    assertThat(store().getDependencies(TODAY + 1000, 1000L).execute()).containsOnly(
      DependencyLink.newBuilder()
        .parent(frontend.serviceName())
        .child(backend.serviceName())
        .callCount(1)
        .build(),
      DependencyLink.newBuilder()
        .parent(backend.serviceName())
        .child(db.serviceName())
        .callCount(1)
        .build()
    );
  }
This test confirms that the span store can process trace with intermediate spans like the below
properly.
<p>
span1: SR SS span2: intermediate call span3: CS SR SS CR: Dependency 1
zipkin-tests/src/main/java/zipkin2/storage/ITDependencies.java