Class GetMockMvcResponseResultSupplier

    • Method Detail

      • response

        public static GetMockMvcResponseResultSupplier response​(org.springframework.test.web.servlet.RequestBuilder builder)
        Creates a step that gets a response.
        Parameters:
        builder - is a request specification
        Returns:
        an instance of GetMockMvcResponseResultSupplier
      • response

        public static GetMockMvcResponseResultSupplier response​(org.springframework.test.web.servlet.MockMvc mockMvc,
                                                                org.springframework.test.web.servlet.RequestBuilder builder)
        Creates a step that gets a response.
        Parameters:
        mockMvc - explicitly defined instance of MockMvc
        builder - is a request specification
        Returns:
        an instance of GetMockMvcResponseResultSupplier
      • expectJsonPath

        public GetMockMvcResponseResultSupplier expectJsonPath​(String expression,
                                                               Function<org.springframework.test.web.servlet.result.JsonPathResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher,
                                                               Object... jsonPathArgs)
        Evaluate the JSON path expression against the response and assert the result in fluent way
        Parameters:
        expression - the JSON path expression, optionally parameterized with arguments
        createMatcher - the function what describes the assertion

        Example: jsonMatchers -> jsonMatchers.value(value)
        jsonPathArgs - arguments to parameterize the JSON path expression with
        Returns:
        self-reference
      • expectJsonPath

        public GetMockMvcResponseResultSupplier expectJsonPath​(String expression,
                                                               Object... jsonPathArgs)
        Evaluate the JSON path expression against the response content and assert that a non-null value, possibly an empty array or map, exists at the given path. If the JSON path expression is not definite, this method asserts that the value at the given path is not empty.
      • expectJsonPathValue

        public GetMockMvcResponseResultSupplier expectJsonPathValue​(String expression,
                                                                    Object value,
                                                                    Object... jsonPathArgs)
        Evaluate the JSON path expression against the response content and assert that the result is equal to the supplied value.
      • expectJsonPathValue

        public <T> GetMockMvcResponseResultSupplier expectJsonPathValue​(String expression,
                                                                        org.hamcrest.Matcher<? super T> matcher,
                                                                        Object... jsonPathArgs)
        Evaluate the JSON path expression against the response content and assert the resulting value with the given Hamcrest Matcher
      • expectJsonPath

        public <T> GetMockMvcResponseResultSupplier expectJsonPath​(String expression,
                                                                   org.hamcrest.Matcher<? super T> matcher,
                                                                   Class<T> targetType,
                                                                   Object... jsonPathArgs)
        Evaluate the JSON path expression against the response content and assert the resulting value is read into value of expected type and suits the given matcher.

        This can be useful for matching numbers reliably — for example, to coerce an integer into a double.

      • expectXPath

        public GetMockMvcResponseResultSupplier expectXPath​(String expression,
                                                            Map<String,​String> namespaces,
                                                            Function<org.springframework.test.web.servlet.result.XpathResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher,
                                                            Object... xPathArgs)
        Evaluate the xPath expression against the response and assert the result in fluent way
        Parameters:
        expression - the XPath expression, optionally parameterized with arguments
        namespaces - the namespaces referenced in the XPath expression
        createMatcher - the function what describes the assertion

        Example: xpathMatchers -> xpathMatchers.string("someString")
        xPathArgs - arguments to parameterize the XPath expression with
        Returns:
        self-reference
      • expectXPath

        public GetMockMvcResponseResultSupplier expectXPath​(String expression,
                                                            Function<org.springframework.test.web.servlet.result.XpathResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher,
                                                            Object... xPathArgs)
        Evaluate the xPath expression against the response and assert the result in fluent way
        Parameters:
        expression - the XPath expression, optionally parameterized with arguments
        createMatcher - the function what describes the assertion

        Example: xpathMatchers -> xpathMatchers.string("someString")
        xPathArgs - arguments to parameterize the XPath expression with
        Returns:
        self-reference
      • expectStatus

        public GetMockMvcResponseResultSupplier expectStatus​(Function<org.springframework.test.web.servlet.result.StatusResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher)
        Asserts the response status in fluent way
        Parameters:
        createMatcher - the function what describes the assertion

        Example: statusMatchers -> statusMatchers.is2xxSuccessful()
        Returns:
        self-reference
      • expectStatusIs1xxInformational

        public GetMockMvcResponseResultSupplier expectStatusIs1xxInformational()
        Assert the response status code is in the 1xx range.
      • expectStatusReason

        public GetMockMvcResponseResultSupplier expectStatusReason​(org.hamcrest.Matcher<? super String> matcher)
        Assert the Servlet response error message with the given Hamcrest Matcher.
      • expectRequest

        public GetMockMvcResponseResultSupplier expectRequest​(Function<org.springframework.test.web.servlet.result.RequestResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher)
        Asserts the request in fluent way
        Parameters:
        createMatcher - the function what describes the assertion

        Example: requestMatchers -> requestMatchers.asyncStarted()
        Returns:
        self-reference
      • expectView

        public GetMockMvcResponseResultSupplier expectView​(Function<org.springframework.test.web.servlet.result.ViewResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher)
        Asserts view in fluent way
        Parameters:
        createMatcher - the function what describes the assertion

        Example: viewMatchers -> viewMatchers.name(name)
        Returns:
        self-reference
      • expectViewName

        public GetMockMvcResponseResultSupplier expectViewName​(org.hamcrest.Matcher<? super String> nameMatcher)
        Assert the selected view name with the given Hamcrest Matcher.
      • expectModel

        public GetMockMvcResponseResultSupplier expectModel​(Function<org.springframework.test.web.servlet.result.ModelResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher)
        Asserts model in fluent way
        Parameters:
        createMatcher - the function what describes the assertion

        Example: modelMatchers -> modelMatchers.attribute(attribute, value)
        Returns:
        self-reference
      • expectModelAttribute

        public <T> GetMockMvcResponseResultSupplier expectModelAttribute​(String attribute,
                                                                         org.hamcrest.Matcher<? super T> matcher)
        Assert a model attribute value with the given Hamcrest Matcher.
      • expectFlash

        public GetMockMvcResponseResultSupplier expectFlash​(Function<org.springframework.test.web.servlet.result.FlashAttributeResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher)
        Asserts flash attributes in fluent way
        Parameters:
        createMatcher - the function what describes the assertion

        Example: flashMatchers -> flashMatchers.attribute(attribute, value)
        Returns:
        self-reference
      • expectFlashAttribute

        public <T> GetMockMvcResponseResultSupplier expectFlashAttribute​(String attribute,
                                                                         org.hamcrest.Matcher<? super T> matcherValue)
        Assert a flash attribute's value with the given Hamcrest Matcher.
      • expectHandler

        public GetMockMvcResponseResultSupplier expectHandler​(Function<org.springframework.test.web.servlet.result.HandlerResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher)
        Asserts handlers in fluent way
        Parameters:
        createMatcher - the function what describes the assertion

        Example: handlersMatchers -> handlersMatchers.handlerType(handlerType)
        Returns:
        self-reference
      • expectHandlerMethod

        public GetMockMvcResponseResultSupplier expectHandlerMethod​(org.hamcrest.Matcher<? super String> methodNameMatcher)
        Assert the name of the controller method used to process the request using the given Hamcrest Matcher.
      • expectHandlerCall

        public <T,​R> GetMockMvcResponseResultSupplier expectHandlerCall​(Class<T> handlerType,
                                                                              Function<T,​R> getCallResult)
        Assert the controller method used to process the request.

        The expected method is specified through a "mock" controller method invocation similar to MvcUriComponentsBuilder.fromMethodCall(Object).

        Type Parameters:
        T - is a type of expected handler
        Parameters:
        handlerType - is a type of expected handler
        getCallResult - describes expected invocation of a method of the handler. The method which is expected to be invoked should return some value
      • expectHeader

        public GetMockMvcResponseResultSupplier expectHeader​(Function<org.springframework.test.web.servlet.result.HeaderResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher)
        Asserts header in fluent way
        Parameters:
        createMatcher - the function what describes the assertion

        Example: headerMatchers -> headerMatchers.string(headerName, value)
        Returns:
        self-reference
      • expectHeaderValue

        public GetMockMvcResponseResultSupplier expectHeaderValue​(String headerName,
                                                                  org.hamcrest.Matcher<? super String> valueMatcher)
        Assert the primary value of the response header with the given Hamcrest String Matcher.
      • expectContent

        public GetMockMvcResponseResultSupplier expectContent​(Function<org.springframework.test.web.servlet.result.ContentResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher)
        Asserts content in fluent way
        Parameters:
        createMatcher - the function what describes the assertion

        Example: contentMatchers -> contentMatchers.string(expectedString)
        Returns:
        self-reference
      • expectContentType

        public GetMockMvcResponseResultSupplier expectContentType​(String contentType)
        Assert the ServletResponse content type. The given content type must fully match including type, sub-type, and parameters
      • expectContentType

        public GetMockMvcResponseResultSupplier expectContentType​(org.springframework.http.MediaType contentType)
        Assert the ServletResponse content type after parsing it as a MediaType. The given content type must fully match including type, sub-type, and parameters.
      • expectJsonContent

        public GetMockMvcResponseResultSupplier expectJsonContent​(String expectedJsonContent)
        Parse the expected and actual strings as JSON and assert the two are "similar" - i.e. they contain the same attribute-value pairs regardless of formatting with a lenient checking (extensible, and non-strict array ordering).
      • expectJsonContent

        public GetMockMvcResponseResultSupplier expectJsonContent​(String expectedJsonContent,
                                                                  boolean strict)
        Parse the response content and the given string as JSON and assert the two are "similar" - i.e. they contain the same attribute-value pairs regardless of formatting.

        Can compare in two modes, depending on strict parameter value:

        • true: strict checking. Not extensible, and strict array ordering.
        • false: lenient checking. Extensible, and non-strict array ordering.

        Use of this matcher requires the JSONassert library.

      • expectXmlContent

        public GetMockMvcResponseResultSupplier expectXmlContent​(String xmlContent)
        Parse the response content and the given string as XML and assert the two are "similar" - i.e. they contain the same elements and attributes regardless of order.

        Use of this matcher requires the XMLUnit library.

      • expectContent

        public <T> GetMockMvcResponseResultSupplier expectContent​(T serialized,
                                                                  DataTransformer dataTransformer)
        Assert the response body content as a String. It is expected that it is equal to serialized POJO/DTO/collection
        Type Parameters:
        T - is a type of object to be serialized into string and compared with content
        Parameters:
        serialized - is an object to be serialized into string and compared with content
        dataTransformer - performs serialization of the object
      • expectCookie

        public GetMockMvcResponseResultSupplier expectCookie​(Function<org.springframework.test.web.servlet.result.CookieResultMatchers,​org.springframework.test.web.servlet.ResultMatcher> createMatcher)
        Asserts cookie in fluent way
        Parameters:
        createMatcher - the function what describes the assertion

        Example: cookie -> cookie.value(name, value)
        Returns:
        self-reference
      • expectNoResolvedException

        public GetMockMvcResponseResultSupplier expectNoResolvedException()
        Asserts that there is no exception raised by a handler and successfully resolved through a HandlerExceptionResolver.
      • expectResolvedException

        public GetMockMvcResponseResultSupplier expectResolvedException()
        Asserts that there is an exception raised by a handler and successfully resolved through a HandlerExceptionResolver
      • expectResolvedException

        @SafeVarargs
        public final GetMockMvcResponseResultSupplier expectResolvedException​(org.hamcrest.Matcher<? super Throwable>... matchers)
        Asserts exception raised by a handler and successfully resolved through a HandlerExceptionResolver with a Hamcrest Matcher
      • expectResolvedException

        public <T extends ExceptionGetMockMvcResponseResultSupplier expectResolvedException​(Class<T> exceptionClass)
        Asserts exception raised by a handler and successfully resolved through a HandlerExceptionResolver is an object of the defined class (not of any subclass)
      • expectResolvedException

        public <T extends ExceptionGetMockMvcResponseResultSupplier expectResolvedException​(Class<T> exceptionClass,
                                                                                              String message)
        Asserts exception raised by a handler and successfully resolved through a HandlerExceptionResolver is an object of the defined class (not of any subclass) and has defined message
      • expectResolvedException

        @SafeVarargs
        public final <T extends ExceptionGetMockMvcResponseResultSupplier expectResolvedException​(Class<T> exceptionClass,
                                                                                                    org.hamcrest.Matcher<? super String>... messageMatchers)
        Asserts exception raised by a handler and successfully resolved through a HandlerExceptionResolver is an object of the defined class (not of any subclass) and has a message that suits defined Hamcrest Matcher
      • thenGetBody

        public <T> GetObjectFromResponseBody<T> thenGetBody​(DataTransformer transformer,
                                                            Class<T> tClass)
        Creates a step that returns deserialized content of body of the received response.
        Type Parameters:
        T - is a type of deserialized body
        Parameters:
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        Returns:
        an instance of GetObjectFromResponseBody
      • thenGetBody

        public <T> GetObjectFromResponseBody<T> thenGetBody​(DataTransformer transformer,
                                                            com.fasterxml.jackson.core.type.TypeReference<T> tRef)
        Creates a step that returns deserialized content of body of the received response.
        Type Parameters:
        T - is a type of deserialized body
        Parameters:
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        Returns:
        an instance of GetObjectFromResponseBody
      • thenGetValue

        public <T,​R> GetObjectFromResponseBody<T> thenGetValue​(String description,
                                                                     DataTransformer transformer,
                                                                     Class<R> tClass,
                                                                     Function<R,​T> howToGet)
        Creates a step that deserializes content of body of the received response and then return value taken from / calculated by deserialized content.
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of resulted value
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        howToGet - describes how to get desired value
        Returns:
        an instance of GetObjectFromResponseBody
      • thenGetValue

        public <T,​R> GetObjectFromResponseBody<T> thenGetValue​(String description,
                                                                     DataTransformer transformer,
                                                                     com.fasterxml.jackson.core.type.TypeReference<R> tRef,
                                                                     Function<R,​T> howToGet)
        Creates a step that deserializes content of body of the received response and then return value taken from / calculated by deserialized content.
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of resulted value
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        howToGet - describes how to get desired value
        Returns:
        an instance of GetObjectFromResponseBody
      • thenGetValueFromArray

        public <T,​R> GetObjectFromResponseBodyArray<T> thenGetValueFromArray​(String description,
                                                                                   DataTransformer transformer,
                                                                                   Class<R> tClass,
                                                                                   Function<R,​T[]> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an array from deserialized response content
        • - then returns item of the array (the first found or one that matches defined criteria)
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of resulted value
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        howToGet - describes how to get an array
        Returns:
        an instance of GetObjectFromResponseBodyArray
      • thenGetValueFromArray

        public <T,​R> GetObjectFromResponseBodyArray<T> thenGetValueFromArray​(String description,
                                                                                   DataTransformer transformer,
                                                                                   com.fasterxml.jackson.core.type.TypeReference<R> tRef,
                                                                                   Function<R,​T[]> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an array from deserialized response content
        • - then returns item of the array (the first found or one that matches defined criteria)
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of resulted value
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        howToGet - describes how to get an array
        Returns:
        an instance of GetObjectFromResponseBodyArray
      • thenGetValueFromArray

        public <T,​R> GetObjectFromResponseBodyArray<T> thenGetValueFromArray​(String description,
                                                                                   com.fasterxml.jackson.core.type.TypeReference<R> tRef,
                                                                                   Function<R,​T[]> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an array from deserialized response content
        • - then returns item of the array (the first found or one that matches defined criteria)

        Value of SpringMockMvcDefaultResponseBodyTransformer.SPRING_MOCK_MVC_DEFAULT_RESPONSE_BODY_TRANSFORMER is used to deserialize string body content.

        Type Parameters:
        R - is a type of deserialized body
        T - is a type of resulted value
        Parameters:
        description - is description of value to get
        tRef - is a type of result of performed deserialization
        howToGet - describes how to get an array
        Returns:
        an instance of GetObjectFromResponseBodyArray
      • thenGetValueFromArray

        public <T> GetObjectFromResponseBodyArray<T> thenGetValueFromArray​(String description,
                                                                           DataTransformer transformer,
                                                                           Class<T[]> tClass)
        Creates a step that:
        • - deserializes content of body of the received response to array
        • - then returns item of the array (the first found or one that matches defined criteria)
        Type Parameters:
        T - is a type of resulted value
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        Returns:
        an instance of GetObjectFromResponseBodyArray
      • thenGetValueFromArray

        public <T> GetObjectFromResponseBodyArray<T> thenGetValueFromArray​(String description,
                                                                           DataTransformer transformer,
                                                                           com.fasterxml.jackson.core.type.TypeReference<T[]> tRef)
        Creates a step that:
        • - deserializes content of body of the received response to array
        • - then returns item of the array (the first found or one that matches defined criteria)
        Type Parameters:
        T - is a type of resulted value
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        Returns:
        an instance of GetObjectFromResponseBodyArray
      • thenGetValueFromIterable

        public <T,​R,​S extends Iterable<T>> GetObjectFromResponseBodyIterable<T> thenGetValueFromIterable​(String description,
                                                                                                                     DataTransformer transformer,
                                                                                                                     Class<R> tClass,
                                                                                                                     Function<R,​S> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an Iterable from deserialized response content
        • - then returns item of the iterable (the first found or one that matches defined criteria)
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of resulted value
        S - is a type of iterable
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        howToGet - describes how to get desired value
        Returns:
        an instance of GetObjectFromResponseBodyIterable
      • thenGetValueFromIterable

        public <T,​R,​S extends Iterable<T>> GetObjectFromResponseBodyIterable<T> thenGetValueFromIterable​(String description,
                                                                                                                     DataTransformer transformer,
                                                                                                                     com.fasterxml.jackson.core.type.TypeReference<R> tRef,
                                                                                                                     Function<R,​S> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an Iterable from deserialized response content
        • - then returns item of the iterable (the first found or one that matches defined criteria)
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of resulted value
        S - is a type of iterable
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        howToGet - describes how to get desired value
        Returns:
        an instance of GetObjectFromResponseBodyIterable
      • thenGetValueFromIterable

        public <T,​R,​S extends Iterable<T>> GetObjectFromResponseBodyIterable<T> thenGetValueFromIterable​(String description,
                                                                                                                     com.fasterxml.jackson.core.type.TypeReference<R> tRef,
                                                                                                                     Function<R,​S> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an Iterable from deserialized response content
        • - then returns item of the iterable (the first found or one that matches defined criteria)

        Value of SpringMockMvcDefaultResponseBodyTransformer.SPRING_MOCK_MVC_DEFAULT_RESPONSE_BODY_TRANSFORMER is used to deserialize string body content.

        Type Parameters:
        R - is a type of deserialized body
        T - is a type of resulted value
        S - is a type of iterable
        Parameters:
        description - is description of value to get
        tRef - is a type of result of performed deserialization
        howToGet - describes how to get desired value
        Returns:
        an instance of GetObjectFromResponseBodyIterable
      • thenGetValueFromIterable

        public <T,​S extends Iterable<T>> GetObjectFromResponseBodyIterable<T> thenGetValueFromIterable​(String description,
                                                                                                             DataTransformer transformer,
                                                                                                             Class<S> tClass)
        Creates a step that:
        • - deserializes content of body of the received response to Iterable
        • - then returns item of the iterable (the first found or one that matches defined criteria)
        Type Parameters:
        T - is a type of resulted value
        S - is a type of iterable
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        Returns:
        an instance of GetObjectFromResponseBodyIterable
      • thenGetValueFromIterable

        public <T,​S extends Iterable<T>> GetObjectFromResponseBodyIterable<T> thenGetValueFromIterable​(String description,
                                                                                                             DataTransformer transformer,
                                                                                                             com.fasterxml.jackson.core.type.TypeReference<S> tRef)
        Creates a step that:
        • - deserializes content of body of the received response to Iterable
        • - then returns item of the iterable (the first found or one that matches defined criteria)
        Type Parameters:
        T - is a type of resulted value
        S - is a type of iterable
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        Returns:
        an instance of GetObjectFromResponseBodyIterable
      • thenGetList

        public <T,​R,​S extends Iterable<T>> GetListFromResponse<T,​S> thenGetList​(String description,
                                                                                                  DataTransformer transformer,
                                                                                                  Class<R> tClass,
                                                                                                  Function<R,​S> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an Iterable from deserialized response content
        • - then returns items of the iterable (all items or ones that match defined criteria)
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of item from resulted iterable
        S - is a type of resulted iterable
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        howToGet - describes how to get desired value
        Returns:
        an instance of GetListFromResponse
      • thenGetList

        public <T,​R,​S extends Iterable<T>> GetListFromResponse<T,​S> thenGetList​(String description,
                                                                                                  DataTransformer transformer,
                                                                                                  com.fasterxml.jackson.core.type.TypeReference<R> tRef,
                                                                                                  Function<R,​S> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an Iterable from deserialized response content
        • - then returns items of the iterable (all items or ones that match defined criteria)
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of item from resulted iterable
        S - is a type of resulted iterable
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        howToGet - describes how to get desired value
        Returns:
        an instance of GetListFromResponse
      • thenGetList

        public <T,​R,​S extends Iterable<T>> GetListFromResponse<T,​S> thenGetList​(String description,
                                                                                                  Class<R> tClass,
                                                                                                  Function<R,​S> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an Iterable from deserialized response content
        • - then returns items of the iterable (all items or ones that match defined criteria)

        Value of SpringMockMvcDefaultResponseBodyTransformer.SPRING_MOCK_MVC_DEFAULT_RESPONSE_BODY_TRANSFORMER is used to deserialize string body content.

        Type Parameters:
        R - is a type of deserialized body
        T - is a type of item from resulted iterable
        S - is a type of resulted iterable
        Parameters:
        description - is description of value to get
        tClass - is a class of result of performed deserialization
        howToGet - describes how to get desired value
        Returns:
        an instance of GetListFromResponse
      • thenGetList

        public <T,​R,​S extends Iterable<T>> GetListFromResponse<T,​S> thenGetList​(String description,
                                                                                                  com.fasterxml.jackson.core.type.TypeReference<R> tRef,
                                                                                                  Function<R,​S> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an Iterable from deserialized response content
        • - then returns items of the iterable (all items or ones that match defined criteria)

        Value of SpringMockMvcDefaultResponseBodyTransformer.SPRING_MOCK_MVC_DEFAULT_RESPONSE_BODY_TRANSFORMER is used to deserialize string body content.

        Type Parameters:
        R - is a type of deserialized body
        T - is a type of item from resulted iterable
        S - is a type of resulted iterable
        Parameters:
        description - is description of value to get
        tRef - is a type of result of performed deserialization
        howToGet - describes how to get desired value
        Returns:
        an instance of GetListFromResponse
      • thenGetList

        public <T,​S extends Iterable<T>> GetListFromResponse<T,​S> thenGetList​(String description,
                                                                                          DataTransformer transformer,
                                                                                          Class<S> tClass)
        Creates a step that:
        • - deserializes content of body of the received response to Iterable
        • - then returns items of the iterable (all items or ones that match defined criteria)
        Type Parameters:
        T - is a type of item from resulted iterable
        S - is a type of resulted iterable
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        Returns:
        an instance of GetListFromResponse
      • thenGetList

        public <T,​S extends Iterable<T>> GetListFromResponse<T,​S> thenGetList​(String description,
                                                                                          DataTransformer transformer,
                                                                                          com.fasterxml.jackson.core.type.TypeReference<S> tRef)
        Creates a step that:
        • - deserializes content of body of the received response to Iterable
        • - then returns items of the iterable (all items or ones that match defined criteria)
        Type Parameters:
        T - is a type of item from resulted iterable
        S - is a type of resulted iterable
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        Returns:
        an instance of GetListFromResponse
      • thenGetArray

        public <T,​R> GetArrayFromResponse<T> thenGetArray​(String description,
                                                                DataTransformer transformer,
                                                                Class<R> tClass,
                                                                Function<R,​T[]> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an array from deserialized response content
        • - then returns items of the array (all items or ones that match defined criteria)
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of item of resulted array
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        howToGet - describes how to get an array
        Returns:
        an instance of GetArrayFromResponse
      • thenGetArray

        public <T,​R> GetArrayFromResponse<T> thenGetArray​(String description,
                                                                DataTransformer transformer,
                                                                com.fasterxml.jackson.core.type.TypeReference<R> tRef,
                                                                Function<R,​T[]> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an array from deserialized response content
        • - then returns items of the array (all items or ones that match defined criteria)
        Type Parameters:
        R - is a type of deserialized body
        T - is a type of item of resulted array
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        howToGet - describes how to get an array
        Returns:
        an instance of GetArrayFromResponse
      • thenGetArray

        public <T,​R> GetArrayFromResponse<T> thenGetArray​(String description,
                                                                Class<R> tClass,
                                                                Function<R,​T[]> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an array from deserialized response content
        • - then returns items of the array (all items or ones that match defined criteria)

        Value of SpringMockMvcDefaultResponseBodyTransformer.SPRING_MOCK_MVC_DEFAULT_RESPONSE_BODY_TRANSFORMER is used to deserialize string body content.

        Type Parameters:
        R - is a type of deserialized body
        T - is a type of item of resulted array
        Parameters:
        description - is description of value to get
        tClass - is a class of result of performed deserialization
        howToGet - describes how to get an array
        Returns:
        an instance of GetArrayFromResponse
      • thenGetArray

        public <T,​R> GetArrayFromResponse<T> thenGetArray​(String description,
                                                                com.fasterxml.jackson.core.type.TypeReference<R> tRef,
                                                                Function<R,​T[]> howToGet)
        Creates a step that:
        • - deserializes content of body of the received response
        • - then tries to get an array from deserialized response content
        • - then returns items of the array (all items or ones that match defined criteria)

        Value of SpringMockMvcDefaultResponseBodyTransformer.SPRING_MOCK_MVC_DEFAULT_RESPONSE_BODY_TRANSFORMER is used to deserialize string body content.

        Type Parameters:
        R - is a type of deserialized body
        T - is a type of item of resulted array
        Parameters:
        description - is description of value to get
        tRef - is a type of result of performed deserialization
        howToGet - describes how to get an array
        Returns:
        an instance of GetArrayFromResponse
      • thenGetArray

        public <T> GetArrayFromResponse<T> thenGetArray​(String description,
                                                        DataTransformer transformer,
                                                        Class<T[]> tClass)
        Creates a step that:
        • - deserializes content of body of the received response to array
        • - then returns items of the array (all items or ones that match defined criteria)
        Type Parameters:
        T - is a type of item of resulted array
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tClass - is a class of result of performed deserialization
        Returns:
        an instance of GetArrayFromResponse
      • thenGetArray

        public <T> GetArrayFromResponse<T> thenGetArray​(String description,
                                                        DataTransformer transformer,
                                                        com.fasterxml.jackson.core.type.TypeReference<T[]> tRef)
        Creates a step that:
        • - deserializes content of body of the received response to array
        • - then returns items of the array (all items or ones that match defined criteria)
        Type Parameters:
        T - is a type of item of resulted array
        Parameters:
        description - is description of value to get
        transformer - performs deserialization
        tRef - is a type of result of performed deserialization
        Returns:
        an instance of GetArrayFromResponse