MockEngine

class MockEngine(initialRules: List<MockRule>, enabled: Boolean = true, bodyMatchingEnabled: Boolean = false, maxBodyPredicateBytes: Int = DEFAULT_MAX_BODY_PREDICATE_BYTES)

Constructors

Link copied to clipboard
constructor(initialRules: List<MockRule>, enabled: Boolean = true, bodyMatchingEnabled: Boolean = false, maxBodyPredicateBytes: Int = DEFAULT_MAX_BODY_PREDICATE_BYTES)

Functions

Link copied to clipboard
fun bindPersistence(store: MockRuleStore, currentAppVersion: String, installationId: String)

Restores durable rules and makes subsequent CRUD synchronous with store. A failed save is reported to the caller before the active in-memory rule set changes.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun persist(store: MockRuleStore, currentAppVersion: String, installationId: String)
Link copied to clipboard
Link copied to clipboard
fun restore(store: MockRuleStore, currentAppVersion: String, installationId: String)
Link copied to clipboard
Link copied to clipboard
fun setEnabled(value: Boolean)

Enables/disables one rule without losing it, writing through persistenceBinding exactly like upsert. Matching already honors MockRule.persistence's enabled flag in decide, so this is the only mutation a rule-level toggle needs. Returns false when id is unknown.

Link copied to clipboard

Hit stats for one rule; MockRuleStats.hitCount is 0 (never fabricated) if it has never matched.

Link copied to clipboard

Every rule's hit stats, keyed by rule id -- unmatched rules are simply absent, not zero-filled.

Link copied to clipboard
Link copied to clipboard