@Test
public void exampleSpan() {

  when(mockTracers.getCurrent()).thenReturn(mockTracer);
  TraceService traceService = new CloudTraceSdkTraceService(mockTracers);
  try (TraceService.Span span = traceService.open("JDBC.Driver#connect")) {
    span.annotate(Label.DATABASE_URL, Optional.of("jdbc:mockdriver"));
    span.annotate(Label.SQL_TEXT, Optional.absent());
  }
  ArgumentCaptor<Labels> labels = ArgumentCaptor.forClass(Labels.class);
  InOrder inOrder = inOrder(mockTracer);
  inOrder.verify(mockTracer).startSpan("JDBC.Driver#connect");
  inOrder.verify(mockTracer).annotateSpan(eq(null), labels.capture());
  inOrder.verify(mockTracer).endSpan(null);
  verifyNoMoreInteractions(mockTracer); // No annotation for SQL_TEXT created.
  assertThat(labels.getValue().getLabels())
      .containsExactly(new com.google.cloud.trace.core.Label(
          "g.co/jdbc/url", "jdbc:mockdriver"));
}