### Question:
SpanBuilderSdk implements Span.Builder { @Override public Span.Builder addLink(SpanContext spanContext) { addLink(Link.create(spanContext)); return this; } SpanBuilderSdk(
      String spanName,
      InstrumentationLibraryInfo instrumentationLibraryInfo,
      SpanProcessor spanProcessor,
      TraceConfig traceConfig,
      Resource resource,
      IdsGenerator idsGenerator,
      Clock clock); @Override Span.Builder setParent(Context context); @Override Span.Builder setNoParent(); @Override Span.Builder setSpanKind(Kind spanKind); @Override Span.Builder addLink(SpanContext spanContext); @Override Span.Builder addLink(SpanContext spanContext, Attributes attributes); @Override Span.Builder setAttribute(String key, String value); @Override Span.Builder setAttribute(String key, long value); @Override Span.Builder setAttribute(String key, double value); @Override Span.Builder setAttribute(String key, boolean value); @Override Span.Builder setAttribute(AttributeKey<T> key, T value); @Override Span.Builder setStartTimestamp(long startTimestamp); @Override Span startSpan();  }### Answer:
@Test void addLink() { Span.Builder spanBuilder = tracerSdk.spanBuilder(SPAN_NAME); spanBuilder.addLink(DefaultSpan.getInvalid().getContext()); spanBuilder.addLink(DefaultSpan.getInvalid().getContext(), Attributes.empty()); RecordEventsReadableSpan span = (RecordEventsReadableSpan) spanBuilder.startSpan(); try { assertThat(span.toSpanData().getLinks()).hasSize(2); } finally { span.end(); } }
@Test void addLinkSpanContext_null() { assertThrows(NullPointerException.class, () -> tracerSdk.spanBuilder(SPAN_NAME).addLink(null)); }
@Test void addLinkSpanContextAttributes_nullContext() { assertThrows( NullPointerException.class, () -> tracerSdk.spanBuilder(SPAN_NAME).addLink(null, Attributes.empty())); }
@Test void addLinkSpanContextAttributes_nullAttributes() { assertThrows( NullPointerException.class, () -> tracerSdk.spanBuilder(SPAN_NAME).addLink(DefaultSpan.getInvalid().getContext(), null)); }