Class SpanDataAssert

java.lang.Object
org.assertj.core.api.AbstractAssert<SpanDataAssert,io.opentelemetry.sdk.trace.data.SpanData>
io.opentelemetry.sdk.testing.assertj.SpanDataAssert
All Implemented Interfaces:
org.assertj.core.api.Assert<SpanDataAssert,io.opentelemetry.sdk.trace.data.SpanData>, org.assertj.core.api.Descriptable<SpanDataAssert>, org.assertj.core.api.ExtensionPoints<SpanDataAssert,io.opentelemetry.sdk.trace.data.SpanData>

public final class SpanDataAssert extends org.assertj.core.api.AbstractAssert<SpanDataAssert,io.opentelemetry.sdk.trace.data.SpanData>
Assertions for an exported SpanData.
  • Method Details

    • hasTraceId

      public SpanDataAssert hasTraceId(String traceId)
      Asserts the span has the given trace ID.
    • hasSpanId

      public SpanDataAssert hasSpanId(String spanId)
      Asserts the span has the given span ID.
    • isSampled

      public SpanDataAssert isSampled()
      Asserts the span is sampled.
    • isNotSampled

      public SpanDataAssert isNotSampled()
      Asserts the span is not sampled.
    • hasTraceState

      public SpanDataAssert hasTraceState(io.opentelemetry.api.trace.TraceState traceState)
      Asserts the span has the given TraceState.
    • hasParentSpanId

      public SpanDataAssert hasParentSpanId(String parentSpanId)
      Asserts the span has the given parent span ID.
    • hasParent

      public SpanDataAssert hasParent(io.opentelemetry.sdk.trace.data.SpanData parent)
      Asserts the span has the given parent span.

      Equivalent to span.hasParentSpanId(parent.getSpanId()).

    • hasNoParent

      public SpanDataAssert hasNoParent()
      Asserts the span has no parent span.

      Equivalent to span.hasParentSpanId(SpanId.getInvalid()).

    • hasResource

      public SpanDataAssert hasResource(io.opentelemetry.sdk.resources.Resource resource)
      Asserts the span has the given Resource.
    • hasInstrumentationLibraryInfo

      public SpanDataAssert hasInstrumentationLibraryInfo(io.opentelemetry.sdk.common.InstrumentationLibraryInfo instrumentationLibraryInfo)
      Asserts the span has the given InstrumentationLibraryInfo.
    • hasName

      public SpanDataAssert hasName(String name)
      Asserts the span has the given name.
    • hasKind

      public SpanDataAssert hasKind(io.opentelemetry.api.trace.SpanKind kind)
      Asserts the span has the given kind.
    • startsAt

      public SpanDataAssert startsAt(long startEpochNanos)
      Asserts the span starts at the given epoch timestamp, in nanos.
    • startsAt

      public SpanDataAssert startsAt(long startEpoch, TimeUnit unit)
      Asserts the span starts at the given epoch timestamp.
    • startsAt

      public SpanDataAssert startsAt(Instant timestamp)
      Asserts the span starts at the given epoch timestamp.
    • hasAttributes

      public SpanDataAssert hasAttributes(io.opentelemetry.api.common.Attributes attributes)
      Asserts the span has the given attributes.
    • hasAttributes

      @SafeVarargs public final SpanDataAssert hasAttributes(Map.Entry<? extends io.opentelemetry.api.common.AttributeKey<?>,?>... entries)
      Asserts the span has the given attributes.
    • hasAttributesSatisfying

      public SpanDataAssert hasAttributesSatisfying(Consumer<io.opentelemetry.api.common.Attributes> attributes)
      Asserts the span has attributes satisfying the given condition.
    • hasException

      public SpanDataAssert hasException(Throwable exception)
      Asserts the span has an exception event for the given Throwable. The stack trace is not matched against.
    • hasEvents

      public SpanDataAssert hasEvents(Iterable<io.opentelemetry.sdk.trace.data.EventData> events)
      Asserts the span has the given events.
    • hasEvents

      public SpanDataAssert hasEvents(io.opentelemetry.sdk.trace.data.EventData... events)
      Asserts the span has the given events.
    • hasEventsSatisfying

      public SpanDataAssert hasEventsSatisfying(Consumer<List<? extends io.opentelemetry.sdk.trace.data.EventData>> condition)
      Asserts the span has events satisfying the given condition.
    • hasEventsSatisfyingExactly

      @SafeVarargs public final SpanDataAssert hasEventsSatisfyingExactly(Consumer<EventDataAssert>... assertions)
      Asserts that the span under assertion has the same number of events as provided assertions and executes each EventDataAssert in assertions in order with the corresponding event.
    • hasLinks

      public SpanDataAssert hasLinks(Iterable<io.opentelemetry.sdk.trace.data.LinkData> links)
      Asserts the span has the given links.
    • hasLinks

      public SpanDataAssert hasLinks(io.opentelemetry.sdk.trace.data.LinkData... links)
      Asserts the span has the given links.
    • hasLinksSatisfying

      public SpanDataAssert hasLinksSatisfying(Consumer<List<? extends io.opentelemetry.sdk.trace.data.LinkData>> condition)
      Asserts the span has events satisfying the given condition.
    • hasStatus

      public SpanDataAssert hasStatus(io.opentelemetry.sdk.trace.data.StatusData status)
      Asserts the span has the given StatusData.
    • endsAt

      public SpanDataAssert endsAt(long endEpochNanos)
      Asserts the span ends at the given epoch timestamp, in nanos.
    • endsAt

      public SpanDataAssert endsAt(long startEpoch, TimeUnit unit)
      Asserts the span ends at the given epoch timestamp.
    • endsAt

      public SpanDataAssert endsAt(Instant timestamp)
      Asserts the span ends at the given epoch timestamp.
    • hasEnded

      public SpanDataAssert hasEnded()
      Asserts the span has ended.
    • hasNotEnded

      public SpanDataAssert hasNotEnded()
      Asserts the span has not ended.
    • hasTotalRecordedEvents

      public SpanDataAssert hasTotalRecordedEvents(int totalRecordedEvents)
      Asserts the span has the given total recorded events.
    • hasTotalRecordedLinks

      public SpanDataAssert hasTotalRecordedLinks(int totalRecordedLinks)
      Asserts the span has the given total recorded links.
    • hasTotalAttributeCount

      public SpanDataAssert hasTotalAttributeCount(int totalAttributeCount)
      Asserts the span has the given total attributes.