@Test protected void getTraces_annotation(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    Span clientSpan = newClientSpan(testSuffix).toBuilder()
      .addAnnotation(TODAY, "foo")
      .build();

    accept(clientSpan);

    // fetch by time based annotation, find trace
    assertGetTracesReturns(
      requestBuilder()
        .serviceName(clientSpan.localServiceName())
        .parseAnnotationQuery(clientSpan.annotations().get(0).value())
        .build(),
      List.of(clientSpan));

    // should find traces by a tag
    Map.Entry<String, String> tag = clientSpan.tags().entrySet().iterator().next();
    assertGetTracesReturns(
      requestBuilder()
        .serviceName(clientSpan.localServiceName())
        .parseAnnotationQuery(tag.getKey() + "=" + tag.getValue())
        .build(),
      List.of(clientSpan));
  }
Prevents subtle bugs which can result in mixed-length traces from linking.
zipkin-tests/src/main/java/zipkin2/storage/ITSpanStore.java