pub struct MockExpectations {
pub(crate) expected_bodies: Vec<camel_component_api::Body>,
pub(crate) expected_headers: Vec<(String, serde_json::Value)>,
pub(crate) expected_header_regexes: Vec<(String, String)>,
pub(crate) expected_count: Option<usize>,
pub(crate) minimum_count: Option<usize>,
}
impl Default for MockExpectations {
fn default() -> Self {
Self::new()
}
}
impl MockExpectations {
pub fn new() -> Self {
Self {
expected_bodies: Vec::new(),
expected_headers: Vec::new(),
expected_header_regexes: Vec::new(),
expected_count: None,
minimum_count: None,
}
}
pub fn push_body(&mut self, body: camel_component_api::Body) {
self.expected_bodies.push(body);
}
pub fn push_header(&mut self, key: String, value: serde_json::Value) {
self.expected_headers.push((key, value));
}
pub fn push_header_regex(&mut self, key: String, pattern: String) {
self.expected_header_regexes.push((key, pattern));
}
pub(crate) fn set_expected_count(&mut self, n: usize) {
self.expected_count = Some(n);
}
pub(crate) fn set_minimum_count(&mut self, n: usize) {
self.minimum_count = Some(n);
}
}