Package kong.unirest.core
Class Routes
- java.lang.Object
-
- kong.unirest.core.Routes
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Invocation>
invokes
private HttpMethod
method
private java.lang.String
path
-
Constructor Summary
Constructors Constructor Description Routes(HttpMethod method, Path p)
Routes(HttpRequest request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addInvoke(Invocation invocation)
private Headers
allHeaders()
(package private) RawResponse
exchange(HttpRequest request, Config config)
private java.util.Optional<Invocation>
getBestMatch(HttpRequest request)
private java.util.Optional<Invocation>
getBestMatch(HttpRequest request, boolean expected)
(package private) HttpMethod
getMethod()
(package private) java.lang.String
getPath()
Assert
hadBody(java.lang.String expected)
Assert that any the request sent this body.Assert
hadField(java.lang.String name, java.lang.String value)
Assert that any the request sent a multipart fieldAssert
hadHeader(java.lang.String key, java.lang.String value)
Assert that any request to this method/path contained this header(package private) boolean
matches(HttpMethod httpMethod, Path url)
(package private) boolean
matches(HttpRequest request)
(package private) Expectation
newExpectation()
private java.lang.Integer
sumInvokes()
Assert
verifyAll()
verify that all Expectations were fulfilled at least once.Assert
wasInvokedTimes(int i)
assert that this instance of method/path was invoked x times
-
-
-
Field Detail
-
path
private final java.lang.String path
-
method
private final HttpMethod method
-
invokes
private final java.util.List<Invocation> invokes
-
-
Constructor Detail
-
Routes
Routes(HttpRequest request)
-
Routes
public Routes(HttpMethod method, Path p)
-
-
Method Detail
-
newExpectation
Expectation newExpectation()
-
matches
boolean matches(HttpRequest request)
-
exchange
RawResponse exchange(HttpRequest request, Config config)
-
matches
boolean matches(HttpMethod httpMethod, Path url)
-
getBestMatch
private java.util.Optional<Invocation> getBestMatch(HttpRequest request)
-
getBestMatch
private java.util.Optional<Invocation> getBestMatch(HttpRequest request, boolean expected)
-
hadHeader
public Assert hadHeader(java.lang.String key, java.lang.String value)
Description copied from interface:Assert
Assert that any request to this method/path contained this header
-
hadBody
public Assert hadBody(java.lang.String expected)
Description copied from interface:Assert
Assert that any the request sent this body. this only applies to non-multipart requests.
-
hadField
public Assert hadField(java.lang.String name, java.lang.String value)
Description copied from interface:Assert
Assert that any the request sent a multipart field
-
allHeaders
private Headers allHeaders()
-
wasInvokedTimes
public Assert wasInvokedTimes(int i)
Description copied from interface:Assert
assert that this instance of method/path was invoked x times- Specified by:
wasInvokedTimes
in interfaceAssert
- Parameters:
i
- the number of times invoked.- Returns:
- this Assert instance
-
sumInvokes
private java.lang.Integer sumInvokes()
-
verifyAll
public Assert verifyAll()
Description copied from interface:Assert
verify that all Expectations were fulfilled at least once.
-
getMethod
HttpMethod getMethod()
-
getPath
java.lang.String getPath()
-
addInvoke
void addInvoke(Invocation invocation)
-
-