public ScopedSpan startScopedSpanWithParent(String name, @Nullable TraceContext parent) {
    if (name == null) throw new NullPointerException("name == null");
    TraceContext context =
      parent != null ? decorateContext(parent, parent.spanId()) : newRootContext(0);
    return newScopedSpan(parent, context, name);
  }
@Test void startScopedSpanWithParent_resultantSpanIsLocalRoot() {
    ScopedSpan span = tracer.startScopedSpanWithParent("foo", context);
    try {
      assertThat(span.context().spanId()).isEqualTo(span.context().localRootId()); // Sanity check
      assertThat(span.context().isLocalRoot()).isTrue();

      ScopedSpan child = tracer.startScopedSpanWithParent("bar", span.context());
      try {

        // Check we don't always make children local roots
        assertThat(child.context().localRootId()).isEqualTo(span.context().localRootId());
        assertThat(child.context().isLocalRoot()).isFalse();
      } finally {
        child.finish();
      }
    } finally {
      span.finish();
    }
  }