Class CompositeContractTemplate
java.lang.Object
org.springframework.cloud.contract.spec.internal.CompositeContractTemplate
- All Implemented Interfaces:
ContractTemplate
For backward compatibility when assertions take place, first checks the custom setup.
Writes in a new format, can read the old format.
- Since:
- 2.1.0
- Author:
- Marcin Grzejszczak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbody()Handlebars is using the Mustache template thus it looks like this {{ Mustache }}.escapedBody(String jsonPath) Handlebars is using the Mustache template thus it looks like this {{{ Mustache }}}.escapedCookie(String key) escapedHeader(String key) escapedHeader(String key, int index) Handlebars is using the Mustache template thus it looks like this {{{ Mustache }}}.escapedPath(int index) escapedQuery(String key) escapedQuery(String key, int index) Handlebars is using the Mustache template thus it looks like this {{ Mustache }}.path()path(int index) booleanbooleanstartsWithTemplate(String text) url()
-
Constructor Details
-
CompositeContractTemplate
public CompositeContractTemplate()
-
-
Method Details
-
startsWithTemplate
- Specified by:
startsWithTemplatein interfaceContractTemplate- Parameters:
text- text to assert- Returns:
- asserts whether the given text starts with proper opening template.
-
startsWithEscapedTemplate
- Specified by:
startsWithEscapedTemplatein interfaceContractTemplate- Parameters:
text- text to assert- Returns:
- asserts whether the given text starts with proper opening template for escaped value.
-
openingTemplate
Description copied from interface:ContractTemplateHandlebars is using the Mustache template thus it looks like this {{ Mustache }}. In this case the opening template would return {{- Specified by:
openingTemplatein interfaceContractTemplate- Returns:
- opening template for a variable
-
closingTemplate
Description copied from interface:ContractTemplateHandlebars is using the Mustache template thus it looks like this {{ Mustache }}. In this case the closing template would return }}- Specified by:
closingTemplatein interfaceContractTemplate- Returns:
- closing template for a variable
-
escapedOpeningTemplate
Description copied from interface:ContractTemplateHandlebars is using the Mustache template thus it looks like this {{{ Mustache }}}. In this case the opening template would return {{{- Specified by:
escapedOpeningTemplatein interfaceContractTemplate- Returns:
- escaped opening template for a variable
-
escapedClosingTemplate
Description copied from interface:ContractTemplateHandlebars is using the Mustache template thus it looks like this {{{ Mustache }}}. In this case the closing template would return }}}- Specified by:
escapedClosingTemplatein interfaceContractTemplate- Returns:
- escaped closing template for a variable
-
url
- Specified by:
urlin interfaceContractTemplate- Returns:
- returns the template for retrieving a URL path and query from request
-
query
- Specified by:
queryin interfaceContractTemplate- Parameters:
key- query parameter key- Returns:
- the template for retrieving first value of a query parameter e.g. {{ request.query.search }}
-
query
- Specified by:
queryin interfaceContractTemplate- Parameters:
key- query parameter keyindex- query parameter index- Returns:
- the template for retrieving nth value of a query parameter (zero indexed) e.g. {{ request.query.search.[5] }}
-
path
- Specified by:
pathin interfaceContractTemplate- Returns:
- the template for retrieving a URL path
-
path
- Specified by:
pathin interfaceContractTemplate- Parameters:
index- request path index- Returns:
- the template for retrieving nth value of a URL path (zero indexed) e.g. {{ request.path.[2] }}
-
header
- Specified by:
headerin interfaceContractTemplate- Parameters:
key- headers key- Returns:
- the template for retrieving the first value of a request header e.g. {{ request.headers.X-Request-Id }}
-
header
- Specified by:
headerin interfaceContractTemplate- Parameters:
key- headers keyindex- headers index- Returns:
- the template for retrieving the nth value of a request header (zero indexed) e.g. {{ request.headers.X-Request-Id.[5] }}
-
cookie
- Specified by:
cookiein interfaceContractTemplate- Parameters:
key- cookie key- Returns:
- the template for retrieving the first value of a cookie with certain key
-
body
- Specified by:
bodyin interfaceContractTemplate- Returns:
- request body text (avoid for non-text bodies) e.g. {{ request.body }} . The body will not be escaped so you won't be able to directly embed it in a JSON for example.
-
escapedBody
- Specified by:
escapedBodyin interfaceContractTemplate- Returns:
- request body text (avoid for non-text bodies) e.g. {{{ request.body }}} . The body will not be escaped so you won't be able to directly embed it in a JSON for example.
-
escapedBody
- Specified by:
escapedBodyin interfaceContractTemplate- Parameters:
jsonPath- json path value- Returns:
- request body text for the given JsonPath. e.g. {{{ jsonPath request.body '$.a.b.c' }}}
-
body
- Specified by:
bodyin interfaceContractTemplate- Parameters:
jsonPath- json path value- Returns:
- request body text for the given JsonPath. e.g. {{ jsonPath request.body '$.a.b.c' }}
-
escapedUrl
- Specified by:
escapedUrlin interfaceContractTemplate- Returns:
- the template for retrieving a escaped URL path and query from request
-
escapedQuery
- Specified by:
escapedQueryin interfaceContractTemplate- Parameters:
key- query parameter key- Returns:
- the template for retrieving escaped first value of a query parameter e.g. {{{ request.query.search }}}
-
escapedQuery
- Specified by:
escapedQueryin interfaceContractTemplate- Parameters:
key- query parameter keyindex- query parameter index- Returns:
- the template for retrieving esacped nth value of a query parameter (zero indexed) e.g. {{{ request.query.search.[5] }}}
-
escapedPath
- Specified by:
escapedPathin interfaceContractTemplate- Returns:
- the template for retrieving a escaped URL path
-
escapedPath
- Specified by:
escapedPathin interfaceContractTemplate- Parameters:
index- path index- Returns:
- the template for retrieving escaped nth value of a URL path (zero indexed) e.g. {{{ request.path.[2] }}}
-
escapedHeader
- Specified by:
escapedHeaderin interfaceContractTemplate- Parameters:
key- headers key- Returns:
- the template for retrieving the escaped first value of a request header e.g. {{{ request.headers.X-Request-Id }}}
-
escapedHeader
- Specified by:
escapedHeaderin interfaceContractTemplate- Parameters:
key- headers keyindex- headers index- Returns:
- the template for retrieving the esacaped nth value of a request header (zero indexed) e.g. {{{ request.headers.X-Request-Id.[5] }}}
-
escapedCookie
- Specified by:
escapedCookiein interfaceContractTemplate- Parameters:
key- cookie key- Returns:
- the template for retrieving the escaped first value of a cookie with certain key
-