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

Configures body matching through a JavaBodySpecBuilder scope.

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

Matches the request body string exactly against expectedValue.

Link copied to clipboard

Matches the request body string against a Predicate.

Matches the request body string against a Predicate, with a description.

Link copied to clipboard
Link copied to clipboard

Requires a request cookie with name to equal value.

Link copied to clipboard

Requires that the request does not contain a cookie with name.

Link copied to clipboard

Requires a request cookie with name to match predicate.

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.