Java Response Definition Builder
Java-friendly wrapper around ResponseDefinitionBuilder that returns this from every mutating method, enabling fluent chaining without Kotlin-specific idioms.
Java callers receive this type from JavaBuildingStep.respondsWith and use it to configure the HTTP response for a stub:
mokksy.post(spec -> spec.path("/items"))
.respondsWith(builder -> builder
.body("{\"id\":\"42\"}")
.status(201)
.header("Location", "/items/42")
.delayMillis(50));Content copied to clipboard
For typed response bodies, supply the response class to respondsWith:
mokksy.post(MyRequest.class, spec -> spec.path("/items"))
.respondsWith(MyResponse.class, builder -> builder
.body(new MyResponse("created"))
.status(201));Content copied to clipboard
Type Parameters
P
The type of the request payload.
T
The type of the response body.