1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Test doubles
//!
//! Enable unit testing with controlled inputs and predictable behavior.
pub
pub use DummyApiVersionDiscriminantSource;
pub use FakeCertificaterRetriever;
/// A trait for giving a type a dummy value.
///
/// Sometimes in tests you need to provide a value for a type, but the actual value doesn't matter.
/// This trait allows defining a "dummy" value for a type, separated from an eventual default
/// value, that can be reused across multiple tests.
///
/// Note: should not be confused with "fake" values, fake values aim to be believable and contain
/// valid cryptography (if they have some), dummies don't aim for those characteristics.
///
/// # Example
/// ```
/// use mithril_common::test::double::Dummy;
///
/// struct MyType(String);
///
/// impl Dummy for MyType {
/// fn dummy() -> Self {
/// MyType("whatever".to_string())
/// }
/// }
///
/// let instance = MyType::dummy();
/// ```