pub struct MockComponent { /* private fields */ }Expand description
The Mock component is a testing utility that records every exchange it receives via its producer. It exposes helpers to inspect and assert on the recorded exchanges.
URI format: mock:name
When create_endpoint is called multiple times with the same name, the
returned endpoints share the same received-exchanges storage. This enables
test assertions: create mock, register it, run routes, then inspect via
component.get_endpoint("name").
Implementations§
Source§impl MockComponent
impl MockComponent
pub fn new() -> Self
Sourcepub fn get_endpoint(&self, name: &str) -> Option<Arc<MockEndpointInner>>
pub fn get_endpoint(&self, name: &str) -> Option<Arc<MockEndpointInner>>
Retrieve a previously created endpoint’s inner data by name.
This is the primary way to inspect recorded exchanges in tests.
Trait Implementations§
Source§impl Clone for MockComponent
impl Clone for MockComponent
Source§fn clone(&self) -> MockComponent
fn clone(&self) -> MockComponent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Component for MockComponent
impl Component for MockComponent
Auto Trait Implementations§
impl Freeze for MockComponent
impl RefUnwindSafe for MockComponent
impl Send for MockComponent
impl Sync for MockComponent
impl Unpin for MockComponent
impl UnsafeUnpin for MockComponent
impl UnwindSafe for MockComponent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more