-
public class PactDslRequestWithPath extends PactDslRequestBase
-
-
Field Summary
Fields Modifier and Type Field Description public Consumerconsumerpublic Providerproviderpublic List<ProviderState>statepublic Stringdescriptionprivate Stringpathpublic StringrequestMethodpublic Map<String, List<String>>requestHeaderspublic Map<String, List<String>>querypublic OptionalBodyrequestBodypublic MatchingRulesrequestMatcherspublic GeneratorsrequestGeneratorsprivate List<String>commentsprivate PactSpecVersionversion
-
Method Summary
Modifier and Type Method Description final StringgetPath()final UnitsetPath(String path)final List<String>getComments()final UnitsetComments(List<String> comments)final PactSpecVersiongetVersion()final UnitsetVersion(PactSpecVersion version)final PactDslRequestWithPathmethod(String method)The HTTP method for the request final PactDslRequestWithPathheaders(String firstHeaderName, String firstHeaderValue, String headerNameValuePairs)Headers to be included in the request final PactDslRequestWithPathheaders(Map<String, String> headers)Headers to be included in the request final PactDslRequestWithPathquery(String query)The query string for the request final PactDslRequestWithPathencodedQuery(String query)The encoded query string for the request final PactDslRequestWithPathbody(String body)The body of the request final PactDslRequestWithPathbody(String body, String contentType)The body of the request final PactDslRequestWithPathbody(String body, ContentType contentType)The body of the request final PactDslRequestWithPathbody(Supplier<String> body)The body of the request final PactDslRequestWithPathbody(Supplier<String> body, String contentType)The body of the request final PactDslRequestWithPathbody(Supplier<String> body, ContentType contentType)The body of the request final PactDslRequestWithPathbody(JSONObject body)The body of the request final PactDslRequestWithPathbody(DslPart body)The body of the request final PactDslRequestWithPathbody(Document body)The body of the request final PactDslRequestWithPathbody(PactXmlBuilder xmlBuilder)XML body to return PactDslRequestWithPathbody(MultipartEntityBuilder body)The body of the request final PactDslRequestWithPathbody(BodyBuilder builder)Sets the body using the buidler final PactDslRequestWithPathbodyWithSingleQuotes(String body)The body of the request with possible single quotes as delimiters and using QuoteUtil to convert single quotes to double quotes if required. final PactDslRequestWithPathbodyWithSingleQuotes(String body, String contentType)The body of the request with possible single quotes as delimiters and using QuoteUtil to convert single quotes to double quotes if required. final PactDslRequestWithPathbodyWithSingleQuotes(String body, ContentType contentType)The body of the request with possible single quotes as delimiters and using QuoteUtil to convert single quotes to double quotes if required. final PactDslRequestWithPathpath(String path)The path of the request final PactDslRequestWithPathmatchPath(String pathRegex, String path)The path of the request. final PactDslRequestWithPathmatchPath(String pathRegex)The path of the request. final PactDslRequestWithPathmatchHeader(String header, String regex, String headerExample)Match a request header. final PactDslRequestWithPathmatchHeader(String header, String regex)Match a request header. final PactDslResponsewillRespondWith()Define the response to return final PactDslRequestWithPathmatchQuery(String parameter, String regex, String example)Match a query parameter with a regex. final PactDslRequestWithPathmatchQuery(String parameter, String regex)Match a query parameter with a regex. final PactDslRequestWithPathmatchQuery(String parameter, String regex, List<String> example)Match a repeating query parameter with a regex. final PactDslRequestWithPathwithFileUpload(String partName, String fileName, String fileContentType, ByteArray data)Sets up a file upload request. final PactDslRequestWithPathheaderFromProviderState(String name, String expression, String example)Adds a header that will have it's value injected from the provider state final PactDslRequestWithPathqueryParameterFromProviderState(String name, String expression, String example)Adds a query parameter that will have it's value injected from the provider state final PactDslRequestWithPathpathFromProviderState(String expression, String example)Sets the path to have it's value injected from the provider state final PactDslRequestWithPathqueryMatchingDate(String field, String pattern, String example)Matches a date field using the provided date pattern final PactDslRequestWithPathqueryMatchingDate(String field, String pattern)Matches a date field using the provided date pattern. final PactDslRequestWithPathqueryMatchingTime(String field, String pattern, String example)Matches a time field using the provided time pattern final PactDslRequestWithPathqueryMatchingTime(String field, String pattern)Matches a time field using the provided time pattern. final PactDslRequestWithPathqueryMatchingTime(String field)Matches a time field using the ISO time pattern. final PactDslRequestWithPathqueryMatchingDatetime(String field, String pattern, String example)Matches a datetime field using the provided pattern final PactDslRequestWithPathqueryMatchingDatetime(String field, String pattern)Matches a datetime field using the provided pattern. final PactDslRequestWithPathqueryMatchingISODate(String field, String example)Matches a date field using the ISO date pattern. final PactDslRequestWithPathqueryMatchingISODate(String field)Matches a date field using the ISO date pattern. final PactDslRequestWithPathqueryMatchingISOTime(String field, String example)Matches a time field using the ISO time pattern final PactDslRequestWithPathqueryMatchingISODatetime(String field, String example)Matches a datetime field using the ISO pattern. final PactDslRequestWithPathqueryMatchingISODatetime(String field)Matches a datetime field using the ISO pattern. final PactDslRequestWithPathcomment(String comment)Adds a comment to this interaction final PactDslRequestWithPathaddMetadataValue(String key, String value)Adds additional values to the metadata section of the Pact file final PactDslRequestWithPathaddMetadataValue(String key, JsonValue value)Adds additional values to the metadata section of the Pact file -
-
Method Detail
-
getComments
final List<String> getComments()
-
setComments
final Unit setComments(List<String> comments)
-
getVersion
final PactSpecVersion getVersion()
-
setVersion
final Unit setVersion(PactSpecVersion version)
-
method
final PactDslRequestWithPath method(String method)
The HTTP method for the request
- Parameters:
method- Valid HTTP method
-
headers
final PactDslRequestWithPath headers(String firstHeaderName, String firstHeaderValue, String headerNameValuePairs)
Headers to be included in the request
- Parameters:
firstHeaderName- The name of the first headerfirstHeaderValue- The value of the first headerheaderNameValuePairs- Additional headers in name-value pairs.
-
headers
final PactDslRequestWithPath headers(Map<String, String> headers)
Headers to be included in the request
- Parameters:
headers- Key-value pairs
-
query
final PactDslRequestWithPath query(String query)
The query string for the request
- Parameters:
query- query string
-
encodedQuery
final PactDslRequestWithPath encodedQuery(String query)
The encoded query string for the request
- Parameters:
query- query string
-
body
final PactDslRequestWithPath body(String body)
The body of the request
- Parameters:
body- Request body in string form
-
body
final PactDslRequestWithPath body(String body, String contentType)
The body of the request
- Parameters:
body- Request body in string form
-
body
final PactDslRequestWithPath body(String body, ContentType contentType)
The body of the request
- Parameters:
body- Request body in string form
-
body
final PactDslRequestWithPath body(Supplier<String> body)
The body of the request
- Parameters:
body- Request body in Java Functional Interface Supplier that must return a string
-
body
final PactDslRequestWithPath body(Supplier<String> body, String contentType)
The body of the request
- Parameters:
body- Request body in Java Functional Interface Supplier that must return a string
-
body
final PactDslRequestWithPath body(Supplier<String> body, ContentType contentType)
The body of the request
- Parameters:
body- Request body in Java Functional Interface Supplier that must return a string
-
body
final PactDslRequestWithPath body(JSONObject body)
The body of the request
- Parameters:
body- Request body in JSON form
-
body
final PactDslRequestWithPath body(DslPart body)
The body of the request
- Parameters:
body- Built using the Pact body DSL
-
body
final PactDslRequestWithPath body(Document body)
The body of the request
- Parameters:
body- XML Document
-
body
final PactDslRequestWithPath body(PactXmlBuilder xmlBuilder)
XML body to return
- Parameters:
xmlBuilder- XML Builder used to construct the XML document
-
body
PactDslRequestWithPath body(MultipartEntityBuilder body)
The body of the request
- Parameters:
body- Built using MultipartEntityBuilder
-
body
final PactDslRequestWithPath body(BodyBuilder builder)
Sets the body using the buidler
- Parameters:
builder- Body Builder
-
bodyWithSingleQuotes
final PactDslRequestWithPath bodyWithSingleQuotes(String body)
The body of the request with possible single quotes as delimiters and using QuoteUtil to convert single quotes to double quotes if required.
- Parameters:
body- Request body in string form
-
bodyWithSingleQuotes
final PactDslRequestWithPath bodyWithSingleQuotes(String body, String contentType)
The body of the request with possible single quotes as delimiters and using QuoteUtil to convert single quotes to double quotes if required.
- Parameters:
body- Request body in string form
-
bodyWithSingleQuotes
final PactDslRequestWithPath bodyWithSingleQuotes(String body, ContentType contentType)
The body of the request with possible single quotes as delimiters and using QuoteUtil to convert single quotes to double quotes if required.
- Parameters:
body- Request body in string form
-
path
final PactDslRequestWithPath path(String path)
The path of the request
- Parameters:
path- string path
-
matchPath
@JvmOverloads() final PactDslRequestWithPath matchPath(String pathRegex, String path)
The path of the request. This will generate a random path to use when generating requests if the example value is not provided.
- Parameters:
pathRegex- regular expression to use to match pathspath- string path to use when generating requests
-
matchPath
@JvmOverloads() final PactDslRequestWithPath matchPath(String pathRegex)
The path of the request. This will generate a random path to use when generating requests if the example value is not provided.
- Parameters:
pathRegex- regular expression to use to match paths
-
matchHeader
@JvmOverloads() final PactDslRequestWithPath matchHeader(String header, String regex, String headerExample)
Match a request header. A random example header value will be generated from the provided regular expression if the example value is not provided.
- Parameters:
header- Header to matchregex- Regular expression to matchheaderExample- Example value to use
-
matchHeader
@JvmOverloads() final PactDslRequestWithPath matchHeader(String header, String regex)
Match a request header. A random example header value will be generated from the provided regular expression if the example value is not provided.
- Parameters:
header- Header to matchregex- Regular expression to match
-
willRespondWith
final PactDslResponse willRespondWith()
Define the response to return
-
matchQuery
@JvmOverloads() final PactDslRequestWithPath matchQuery(String parameter, String regex, String example)
Match a query parameter with a regex. A random query parameter value will be generated from the regex if the example value is not provided.
- Parameters:
parameter- Query parameterregex- Regular expression to match withexample- Example value to use for the query parameter (unencoded)
-
matchQuery
@JvmOverloads() final PactDslRequestWithPath matchQuery(String parameter, String regex)
Match a query parameter with a regex. A random query parameter value will be generated from the regex if the example value is not provided.
- Parameters:
parameter- Query parameterregex- Regular expression to match with
-
matchQuery
final PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example)
Match a repeating query parameter with a regex.
- Parameters:
parameter- Query parameterregex- Regular expression to match with each elementexample- Example value list to use for the query parameter (unencoded)
-
withFileUpload
final PactDslRequestWithPath withFileUpload(String partName, String fileName, String fileContentType, ByteArray data)
Sets up a file upload request. This will add the correct content type header to the request
- Parameters:
partName- This is the name of the part in the multipart body.fileName- This is the name of the file that was uploadedfileContentType- This is the content type of the uploaded filedata- This is the actual file contents
-
headerFromProviderState
final PactDslRequestWithPath headerFromProviderState(String name, String expression, String example)
Adds a header that will have it's value injected from the provider state
- Parameters:
name- Header Nameexpression- Expression to be evaluated from the provider stateexample- Example value to use in the consumer test
-
queryParameterFromProviderState
final PactDslRequestWithPath queryParameterFromProviderState(String name, String expression, String example)
Adds a query parameter that will have it's value injected from the provider state
- Parameters:
name- Nameexpression- Expression to be evaluated from the provider stateexample- Example value to use in the consumer test
-
pathFromProviderState
final PactDslRequestWithPath pathFromProviderState(String expression, String example)
Sets the path to have it's value injected from the provider state
- Parameters:
expression- Expression to be evaluated from the provider stateexample- Example value to use in the consumer test
-
queryMatchingDate
final PactDslRequestWithPath queryMatchingDate(String field, String pattern, String example)
Matches a date field using the provided date pattern
- Parameters:
field- field namepattern- pattern to matchexample- Example value
-
queryMatchingDate
final PactDslRequestWithPath queryMatchingDate(String field, String pattern)
Matches a date field using the provided date pattern. The current system date will be used for the example value.
- Parameters:
field- field namepattern- pattern to match
-
queryMatchingTime
final PactDslRequestWithPath queryMatchingTime(String field, String pattern, String example)
Matches a time field using the provided time pattern
- Parameters:
field- field namepattern- pattern to matchexample- Example value
-
queryMatchingTime
final PactDslRequestWithPath queryMatchingTime(String field, String pattern)
Matches a time field using the provided time pattern. The current system time will be used for the example value.
- Parameters:
field- field namepattern- pattern to match
-
queryMatchingTime
final PactDslRequestWithPath queryMatchingTime(String field)
Matches a time field using the ISO time pattern. The current system time will be used for the example value.
- Parameters:
field- field name
-
queryMatchingDatetime
final PactDslRequestWithPath queryMatchingDatetime(String field, String pattern, String example)
Matches a datetime field using the provided pattern
- Parameters:
field- field namepattern- pattern to matchexample- Example value
-
queryMatchingDatetime
final PactDslRequestWithPath queryMatchingDatetime(String field, String pattern)
Matches a datetime field using the provided pattern. The current system date and time will be used for the example value.
- Parameters:
field- field namepattern- pattern to match
-
queryMatchingISODate
@JvmOverloads() final PactDslRequestWithPath queryMatchingISODate(String field, String example)
Matches a date field using the ISO date pattern. The current system date will be used for the example value.
- Parameters:
field- field name
-
queryMatchingISODate
@JvmOverloads() final PactDslRequestWithPath queryMatchingISODate(String field)
Matches a date field using the ISO date pattern. The current system date will be used for the example value.
- Parameters:
field- field name
-
queryMatchingISOTime
final PactDslRequestWithPath queryMatchingISOTime(String field, String example)
Matches a time field using the ISO time pattern
- Parameters:
field- field nameexample- Example value
-
queryMatchingISODatetime
@JvmOverloads() final PactDslRequestWithPath queryMatchingISODatetime(String field, String example)
Matches a datetime field using the ISO pattern. The current system date and time will be used for the example value if not provided.
- Parameters:
field- field nameexample- Example value
-
queryMatchingISODatetime
@JvmOverloads() final PactDslRequestWithPath queryMatchingISODatetime(String field)
Matches a datetime field using the ISO pattern. The current system date and time will be used for the example value if not provided.
- Parameters:
field- field name
-
comment
final PactDslRequestWithPath comment(String comment)
Adds a comment to this interaction
-
addMetadataValue
final PactDslRequestWithPath addMetadataValue(String key, String value)
Adds additional values to the metadata section of the Pact file
-
addMetadataValue
final PactDslRequestWithPath addMetadataValue(String key, JsonValue value)
Adds additional values to the metadata section of the Pact file
-
-
-
-