camel_component_mock/
expectations.rs1pub struct MockExpectations {
10 pub(crate) expected_bodies: Vec<camel_component_api::Body>,
11 pub(crate) expected_headers: Vec<(String, serde_json::Value)>,
12 pub(crate) expected_header_regexes: Vec<(String, String)>,
13 pub(crate) expected_count: Option<usize>,
16 pub(crate) minimum_count: Option<usize>,
19}
20
21impl Default for MockExpectations {
22 fn default() -> Self {
23 Self::new()
24 }
25}
26
27impl MockExpectations {
28 pub fn new() -> Self {
30 Self {
31 expected_bodies: Vec::new(),
32 expected_headers: Vec::new(),
33 expected_header_regexes: Vec::new(),
34 expected_count: None,
35 minimum_count: None,
36 }
37 }
38
39 pub fn push_body(&mut self, body: camel_component_api::Body) {
41 self.expected_bodies.push(body);
42 }
43
44 pub fn push_header(&mut self, key: String, value: serde_json::Value) {
46 self.expected_headers.push((key, value));
47 }
48
49 pub fn push_header_regex(&mut self, key: String, pattern: String) {
51 self.expected_header_regexes.push((key, pattern));
52 }
53
54 pub(crate) fn set_expected_count(&mut self, n: usize) {
56 self.expected_count = Some(n);
57 }
58
59 pub(crate) fn set_minimum_count(&mut self, n: usize) {
61 self.minimum_count = Some(n);
62 }
63}