ModelRequestSpecification

abstract class ModelRequestSpecification<P>(var model: String? = null, val requestBody: MutableList<Matcher<P?>> = mutableListOf(), val requestBodyString: MutableList<Matcher<String?>> = mutableListOf())(source)

Represents a specification model for processing and asserting certain conditions on a request body.

This abstract class allows configuring conditions for matching and validating the attributes or structure of the request body, either as a whole object or in its string representation. Suitable for cases where flexible request validation is needed.

Type Parameters

P

The type parameter specifying the type of object the request body is expected to be.

Inheritors

Constructors

Link copied to clipboard
constructor(model: String? = null, requestBody: MutableList<Matcher<P?>> = mutableListOf(), requestBodyString: MutableList<Matcher<String?>> = mutableListOf())

Properties

Link copied to clipboard
Link copied to clipboard
val requestBody: MutableList<Matcher<P?>>
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard

Adds a matcher to require that the request body string contains the specified substring.

Link copied to clipboard

Adds a condition to ensure the request body contains the specified substring, ignoring case sensitivity.

Link copied to clipboard

Adds a condition to ensure the request body does not contain the specified substring.

Link copied to clipboard

Adds a condition to ensure the request body does not contain the specified substring, ignoring case sensitivity.

Link copied to clipboard

Adds a matcher to require the request body object to be exactly equal to the specified object.

Adds a matcher to require the request body string to be exactly equal to the specified value.

Link copied to clipboard

Adds a matcher that requires the request body string to exactly match the specified JSON payload.

Link copied to clipboard
fun requestMatches(matcher: Matcher<P?>)

Adds a condition to verify that the request matches the specified matcher.

Link copied to clipboard
fun requestMatchesPredicate(predicate: (P) -> Boolean)

Adds a condition to verify that the request matches the specified predicate.

Link copied to clipboard
fun requestSatisfies(description: String? = null, call: (P?) -> Unit)

Adds a condition to verify that the request satisfies the specified call.