Class ResponseFieldTemplateDescriptor


  • public class ResponseFieldTemplateDescriptor
    extends java.lang.Object
    • Constructor Detail

      • ResponseFieldTemplateDescriptor

        public ResponseFieldTemplateDescriptor​(java.lang.String path)
        Create a descriptor defining the replacement of a response field with a response template. See http://wiremock.org/docs/response-templating/ for details.
        Parameters:
        path - jsonPath expression of the field to be replaced
    • Method Detail

      • getPath

        public java.lang.String getPath()
      • getWireMockTemplateExpression

        public java.lang.String getWireMockTemplateExpression()
      • getUriTemplateVariableName

        public java.lang.String getUriTemplateVariableName()
      • replacedWithWireMockTemplateExpression

        public ResponseFieldTemplateDescriptor replacedWithWireMockTemplateExpression​(java.lang.String expression)
        Use a WireMock response template expression to replace the value at path. Expressions can be used as described in the WireMock Response Templating documentation Note that replacedWithUriTemplateVariableValue and replacedWithWireMockTemplateExpression cannot be used together.
        Parameters:
        expression - the Wiremock response template expression (state without curly braces - e.g request.requestLine.pathSegments.[1])
      • replacedWithUriTemplateVariableValue

        public ResponseFieldTemplateDescriptor replacedWithUriTemplateVariableValue​(java.lang.String uriTemplateVariableName)
        The name of the URI template variable to use as a replacement. This requires the use of URI templates using the methods in org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders that take a urlTemplate parameter. Note that replacedWithUriTemplateVariableValue and replacedWithWireMockTemplateExpression cannot be used together.
        Parameters:
        uriTemplateVariableName - the name of the variable in the URI template of the request