#[non_exhaustive]pub enum MockAssertionError {
CountMismatch {
endpoint: String,
expected: usize,
actual: usize,
},
MinimumCountNotMet {
endpoint: String,
minimum: usize,
actual: usize,
},
BodyCountMismatch {
endpoint: String,
expected: usize,
actual: usize,
},
BodyMismatch {
endpoint: String,
index: usize,
expected: String,
actual: String,
},
BodyNotFound {
endpoint: String,
expected: String,
received_count: usize,
},
BodyMatcherFailed {
endpoint: String,
index: usize,
matcher: String,
received: String,
},
HeaderNotFound {
endpoint: String,
key: String,
value: Value,
received_count: usize,
actual_values: Vec<String>,
last_headers: Option<String>,
},
HeaderRegexNotMatched {
endpoint: String,
key: String,
pattern: String,
received_count: usize,
actual_values: Vec<String>,
last_headers: Option<String>,
},
HeaderMatcherFailed {
endpoint: String,
key: String,
matcher: String,
received: String,
},
InvalidHeaderPattern {
endpoint: String,
key: String,
pattern: String,
source: Box<dyn Error + Send + Sync>,
},
InvalidBodyPattern {
endpoint: String,
pattern: String,
source: Box<dyn Error + Send + Sync>,
},
}Expand description
Error returned by MockEndpointInner::try_assert_satisfied when a
recorded expectation is not satisfied (or is malformed).
Every assertion branch of MockEndpointInner::assert_satisfied
corresponds to exactly one variant. The Display output of each variant
equals the panic message the panicking variant produces for the same
condition. Body detail fields are pre-formatted ({:?}) strings.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
CountMismatch
Exact count expectation (expect_count) not met.
Fields
MinimumCountNotMet
Minimum count expectation (expect_minimum_count) not met.
Fields
BodyCountMismatch
Number of expected bodies differs from the number of received bodies.
Fields
BodyMismatch
Ordered body at index does not match the expected body.
Fields
BodyNotFound
Expected body not found in any received exchange (anyOrder mode).
Fields
BodyMatcherFailed
Ordered body matcher at index did not match the received body.
Mismatch-class: trips the fail-fast latch exactly like
MockAssertionError::BodyMismatch.
Fields
HeaderNotFound
Expected header key/value pair not found in any received exchange.
Fields
HeaderRegexNotMatched
No received exchange has the named header matching the regex pattern.
Fields
HeaderMatcherFailed
No received exchange has the named header satisfying the matcher.
Mismatch-class: trips the fail-fast latch exactly like
MockAssertionError::HeaderNotFound.
Fields
received: StringReceived-state clause (same shape as
MockAssertionError::HeaderNotFound) plus a (<note>)
suffix when the matcher reported a shape mismatch.
InvalidHeaderPattern
Header regex pattern failed to compile.
A malformed expectation is a caller programming error, not an expectation mismatch: it does not trip the fail-fast latch.
Fields
InvalidBodyPattern
Body matcher regex pattern failed to compile.
A malformed expectation is a caller programming error, not an expectation mismatch: it does not trip the fail-fast latch.
Trait Implementations§
Source§impl Debug for MockAssertionError
impl Debug for MockAssertionError
Source§impl Display for MockAssertionError
impl Display for MockAssertionError
Source§impl Error for MockAssertionError
impl Error for MockAssertionError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()