### Question:
RecordEventsReadableSpan implements ReadWriteSpan { @Override public SpanData toSpanData() { synchronized (lock) { return SpanWrapper.create( this, links, getImmutableTimedEvents(), getImmutableAttributes(), (attributes == null) ? 0 : attributes.getTotalAddedValues(), totalRecordedEvents, getStatusWithDefault(), name, endEpochNanos, hasEnded); } } private  RecordEventsReadableSpan(
      SpanContext context,
      String name,
      InstrumentationLibraryInfo instrumentationLibraryInfo,
      Kind kind,
      String parentSpanId,
      boolean hasRemoteParent,
      TraceConfig traceConfig,
      SpanProcessor spanProcessor,
      Clock clock,
      Resource resource,
      @Nullable AttributesMap attributes,
      List<SpanData.Link> links,
      int totalRecordedLinks,
      long startEpochNanos); @Override SpanData toSpanData(); @Override boolean hasEnded(); @Override SpanContext getSpanContext(); @Override String getName(); @Override InstrumentationLibraryInfo getInstrumentationLibraryInfo(); @Override long getLatencyNanos(); @Override void setAttribute(String key, String value); @Override void setAttribute(String key, long value); @Override void setAttribute(String key, double value); @Override void setAttribute(String key, boolean value); @Override void setAttribute(AttributeKey<T> key, T value); @Override void addEvent(String name); @Override void addEvent(String name, long timestamp); @Override void addEvent(String name, Attributes attributes); @Override void addEvent(String name, Attributes attributes, long timestamp); @Override void setStatus(StatusCanonicalCode canonicalCode); @Override void setStatus(StatusCanonicalCode canonicalCode, @Nullable String description); @Override void recordException(Throwable exception); @Override void recordException(Throwable exception, Attributes additionalAttributes); @Override void updateName(String name); @Override void end(); @Override void end(EndSpanOptions endOptions); @Override SpanContext getContext(); @Override boolean isRecording(); @Override String toString();  }### Answer:
@Test void toSpanData_immutableLinks() { RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL); SpanData spanData = span.toSpanData(); assertThrows( UnsupportedOperationException.class, () -> spanData.getLinks().add(Link.create(SpanContext.getInvalid()))); }
@Test void toSpanData_immutableEvents() { RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL); SpanData spanData = span.toSpanData(); assertThrows( UnsupportedOperationException.class, () -> spanData.getEvents().add(Event.create(1000, "test", Attributes.empty()))); }