Java Building Step
A Java-friendly wrapper around BuildingStep that exposes respondsWith, respondsWithStream, and respondsWithSseStream as instance methods accepting Consumer instead of Kotlin suspend lambdas.
Instances are returned by dev.mokksy.Mokksy's HTTP method stubs (get, post, etc.). Do not construct directly.
Example (Java):
mokksy.get(spec -> spec.path("/ping"))
.respondsWith(builder -> builder.body("Pong"));
mokksy.post(MyRequest.class, spec -> spec.path("/items"))
.respondsWith(MyResponse.class, builder -> builder
.body(new MyResponse("created"))
.status(201)
.header("Location", "/items/1"));Type Parameters
The type of the request payload.
Functions
Configures a String response for this stub.
Configures a simple String response body for this stub with HTTP 200.
Configures a typed response for this stub.
Configures a simple String response body with a custom HTTP status code.
Configures an SSE streaming response for this stub with ServerSentEventMetadata<String> chunks.
Configures a typed SSE streaming response for this stub.
Associates this stub with a body-free response carrying only an HTTP status code.
Configures a String streaming response for this stub.
Configures a typed streaming response for this stub.