Class ExternalAttachment

java.lang.Object
io.cucumber.messages.types.ExternalAttachment

public final class ExternalAttachment extends Object
Represents the ExternalAttachment message in Cucumber's message protocol

Represents an attachment that is stored externally rather than embedded in the message stream.

This message type is used for large attachments (e.g., video files) that are already on the filesystem and should not be loaded into memory. Instead of embedding the content, only a URL reference is stored.

A formatter or other consumer of messages may replace an Attachment with an ExternalAttachment if it makes sense to do so.

  • Constructor Details

    • ExternalAttachment

      public ExternalAttachment(String url, String mediaType, @Nullable String testCaseStartedId, @Nullable String testStepId, @Nullable String testRunHookStartedId, @Nullable Timestamp timestamp)
  • Method Details

    • getUrl

      public String getUrl()
      A URL where the attachment can be retrieved. This could be a file:// URL for local filesystem paths, or an http(s):// URL for remote resources.
    • getMediaType

      public String getMediaType()
      The media type of the data. This can be any valid [IANA Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml) as well as Cucumber-specific media types such as `text/x.cucumber.gherkin+plain` and `text/x.cucumber.stacktrace+plain`
    • getTestCaseStartedId

      public Optional<String> getTestCaseStartedId()
      The identifier of the test case attempt if the attachment was created during the execution of a test step
    • getTestStepId

      public Optional<String> getTestStepId()
      The identifier of the test step if the attachment was created during the execution of a test step
    • getTestRunHookStartedId

      public Optional<String> getTestRunHookStartedId()
      The identifier of the test run hook execution if the attachment was created during the execution of a test run hook
    • getTimestamp

      public Optional<Timestamp> getTimestamp()
      When the attachment was created
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object