Java Request Specification Builder
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"));Content copied to clipboard
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.
fun bodyMatchesPredicate(description: String?, predicate: Predicate<P>): JavaRequestSpecificationBuilder<P>
Adds a predicate to match against the deserialized request body, with a description.
Link copied to clipboard
Link copied to clipboard
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.