Class MessageContentsBuilder
-
- All Implemented Interfaces:
public final class MessageContentsBuilderDSL builder for the message contents part of a V4 message
-
-
Field Summary
Fields Modifier and Type Field Description private MessageContentscontents
-
Constructor Summary
Constructors Constructor Description MessageContentsBuilder(MessageContents contents)
-
Method Summary
Modifier and Type Method Description final MessageContentsgetContents()final UnitsetContents(MessageContents contents)final MessageContentsbuild()final MessageContentsBuilderwithMetadata(Map<String, Object> metadata)Adds the expected metadata to the message contents final MessageContentsBuilderwithMetadata(Consumer<MetadataBuilder> consumer)Adds the expected metadata to the message using a builder final MessageContentsBuilderwithContent(DslPart body)Adds the JSON body as the message content final MessageContentsBuilderwithContent(PactXmlBuilder xmlBuilder)Adds the XML body as the message content final MessageContentsBuilderwithContent(String payload, String contentType)Adds the string as the message contents with the given content type. final MessageContentsBuilderwithContent(String payload)Adds the string as the message contents with the given content type. final MessageContentsBuilderwithContent(ByteArray payload, String contentType)Sets the contents of the message as a byte array. final MessageContentsBuilderwithContent(ByteArray payload)Sets the contents of the message as a byte array. final MessageContentsBuilderwithContentsMatchingContentType(String contentType, ByteArray exampleContents)Sets up a content type matcher to match any payload of the given content type -
-
Method Detail
-
getContents
final MessageContents getContents()
-
setContents
final Unit setContents(MessageContents contents)
-
build
final MessageContents build()
-
withMetadata
final MessageContentsBuilder withMetadata(Map<String, Object> metadata)
Adds the expected metadata to the message contents
-
withMetadata
final MessageContentsBuilder withMetadata(Consumer<MetadataBuilder> consumer)
Adds the expected metadata to the message using a builder
-
withContent
final MessageContentsBuilder withContent(DslPart body)
Adds the JSON body as the message content
-
withContent
final MessageContentsBuilder withContent(PactXmlBuilder xmlBuilder)
Adds the XML body as the message content
-
withContent
@JvmOverloads() final MessageContentsBuilder withContent(String payload, String contentType)
Adds the string as the message contents with the given content type. If the content type is not supplied, it will try to detect it otherwise will default to plain text.
-
withContent
@JvmOverloads() final MessageContentsBuilder withContent(String payload)
Adds the string as the message contents with the given content type. If the content type is not supplied, it will try to detect it otherwise will default to plain text.
-
withContent
@JvmOverloads() final MessageContentsBuilder withContent(ByteArray payload, String contentType)
Sets the contents of the message as a byte array. If the content type is not provided or already set, will default to application/octet-stream.
-
withContent
@JvmOverloads() final MessageContentsBuilder withContent(ByteArray payload)
Sets the contents of the message as a byte array. If the content type is not provided or already set, will default to application/octet-stream.
-
withContentsMatchingContentType
final MessageContentsBuilder withContentsMatchingContentType(String contentType, ByteArray exampleContents)
Sets up a content type matcher to match any payload of the given content type
-
-
-
-