JavaRequestSpecificationBuilder

Java-friendly wrapper around RequestSpecificationBuilder that replaces Kotlin functional types with their java.util.function equivalents.

Java callers receive this type from dev.mokksy.Mokksy's stub-registration methods (get, post, etc.) and use it to configure request-matching criteria.

All methods return this for fluent chaining:

mokksy.post(spec -> spec
.path("/items")
.bodyMatchesPredicate(body -> body.contains("token")))
.respondsWith(builder -> builder.body("ok"));

Type Parameters

P

The type of the request payload.

Functions

Link copied to clipboard

Requires the request body string to contain all of strings.

Link copied to clipboard

Adds a predicate to match against the deserialized request body.

Adds a predicate to match against the deserialized request body, with a description.

Link copied to clipboard

Requires the request to contain a header with name equal to value.

Link copied to clipboard
fun path(matcher: Matcher<String>): JavaRequestSpecificationBuilder<P>

Matches the request path using a Kotest Matcher.

Matches the request path exactly against path.

Link copied to clipboard

Sets the priority for this stub. Higher values win over lower values.