responds With
Configures a typed response for this stub.
Return
A StubHandle for further inspection (e.g. StubHandle.matchCount).
Parameters
The Java Class of the response type.
A Consumer that configures a JavaResponseDefinitionBuilder.
Type Parameters
The type of the response body.
Configures a String response for this stub.
Shorthand for respondsWith(String.class, configurer).
Return
A StubHandle for further inspection (e.g. StubHandle.matchCount).
Parameters
A Consumer that configures a JavaResponseDefinitionBuilder.
Configures a simple String response body for this stub with HTTP 200.
Shorthand for respondsWith(builder -> builder.body(body)):
mokksy.get("/hello").respondsWith("Hello, World!");Return
A StubHandle for further inspection (e.g. StubHandle.matchCount).
Parameters
The response body string.
Configures a simple String response body with a custom HTTP status code.
Shorthand for respondsWith(builder -> builder.body(body).status(statusCode)):
mokksy.post("/items").respondsWith("{\"id\":42}", 201);Return
A StubHandle for further inspection (e.g. StubHandle.matchCount).
Parameters
The response body string.
The HTTP status code, e.g. 201, 400.