Class Invocation

    • Constructor Detail

      • Invocation

        public Invocation​(Routes routes)
      • Invocation

        Invocation()
    • Method Detail

      • thenReturn

        public ExpectedResponse thenReturn​(java.lang.String body)
        Description copied from interface: Expectation
        expect a string response
        Specified by:
        thenReturn in interface Expectation
        Parameters:
        body - the expected response body
        Returns:
        The ExpectedResponse
      • thenReturn

        public ExpectedResponse thenReturn​(java.lang.Object pojo)
        Description copied from interface: Expectation
        expect a object response as defined by a pojo using the requests / configuration object mapper
        Specified by:
        thenReturn in interface Expectation
        Parameters:
        pojo - the expected response body
        Returns:
        The ExpectedResponse
      • thenReturn

        public ExpectedResponse thenReturn​(java.util.function.Supplier<java.lang.String> supplier)
        Description copied from interface: Expectation
        A supplier for the expected body which will get invoked at the time of build the response.
        Specified by:
        thenReturn in interface Expectation
        Parameters:
        supplier - the expected response body supplier
        Returns:
        The ExpectedResponse
      • thenReturn

        public void thenReturn​(java.util.function.Function<HttpRequest<?>,​ExpectedResponse> fun)
        Description copied from interface: Expectation
        Allows for a full override of the way a expected response is built. useful in building more complicated test-doubles of services that implement logic
        Specified by:
        thenReturn in interface Expectation
        Parameters:
        fun - the function to convert a request to a response
      • allHeaders

        private Headers allHeaders()
      • header

        public Expectation header​(java.lang.String key,
                                  java.lang.String value)
        Description copied from interface: Expectation
        A expected header for a request
        Specified by:
        header in interface Expectation
        Parameters:
        key - the header key
        value - the header value
        Returns:
        this Expectation
      • queryString

        public Expectation queryString​(java.lang.String key,
                                       java.lang.String value)
        Description copied from interface: Expectation
        A expected header for a request
        Specified by:
        queryString in interface Expectation
        Parameters:
        key - the query key
        value - the query value
        Returns:
        this Expectation
      • body

        public Expectation body​(java.lang.String body)
        Description copied from interface: Expectation
        A expected body for a request
        Specified by:
        body in interface Expectation
        Parameters:
        body - the expected body
        Returns:
        this Expectation
      • body

        public Expectation body​(BodyMatcher matcher)
        Description copied from interface: Expectation
        A matcher for the body for a request
        Specified by:
        body in interface Expectation
        Parameters:
        matcher - the matcher
        Returns:
        this Expectation
      • verify

        public void verify()
        Description copied from interface: Expectation
        verify that all Expectations was fulfilled at least once.
        Specified by:
        verify in interface Expectation
      • details

        private java.lang.String details()
      • hasExpectedHeader

        public boolean hasExpectedHeader​(java.lang.String key,
                                         java.lang.String value)
      • getBodyStream

        private java.util.stream.Stream<Body> getBodyStream()
      • hasBody

        public boolean hasBody​(java.lang.String body)
      • uniBodyMatches

        private boolean uniBodyMatches​(java.lang.String body,
                                       Body o)
      • hasField

        public boolean hasField​(java.lang.String name,
                                java.lang.String value)
      • hasField

        private boolean hasField​(java.lang.String name,
                                 java.lang.String value,
                                 Body b)
      • requestSize

        public java.lang.Integer requestSize()
      • getRequests

        public java.util.List<HttpRequest> getRequests()
      • isExpected

        public java.lang.Boolean isExpected()
      • scoreMatch

        public java.lang.Integer scoreMatch​(HttpRequest request)
      • scoreBody

        private int scoreBody​(HttpRequest request)
      • matchBody

        private java.lang.Integer matchBody​(Body b)
      • scoreHeaders

        private int scoreHeaders​(HttpRequest request)
      • scoreQuery

        private int scoreQuery​(HttpRequest request)
      • tryCast

        private static <T,​M extends T> java.util.Optional<M> tryCast​(T original,
                                                                           java.lang.Class<M> too)