@Test
public void getOrCreate_reusesClockFromParent() {

  TraceContext trace = context;
  TraceContext traceJoin = trace.toBuilder().shared(true).build();
  TraceContext trace2 = context.toBuilder().traceId(2L).build();
  TraceContext traceChild =
    TraceContext.newBuilder().traceId(1L).parentId(trace.spanId()).spanId(3L).build();
  PendingSpan traceSpan = pendingSpans.getOrCreate(null, trace, false);
  PendingSpan traceJoinSpan = pendingSpans.getOrCreate(trace, traceJoin, false);
  PendingSpan trace2Span = pendingSpans.getOrCreate(null, trace2, false);
  PendingSpan traceChildSpan = pendingSpans.getOrCreate(trace, traceChild, false);
  assertThat(traceSpan.clock).isSameAs(traceChildSpan.clock);
  assertThat(traceSpan.clock).isSameAs(traceJoinSpan.clock);
  assertThat(traceSpan.clock).isNotSameAs(trace2Span.clock);
}