An ArgumentExpectation[M, I, A]
represents an expectation on input I
arguments
for capability of module M
that returns an effect that may produce a single A
.
A Expectation[-M, +E, +A]
is an immutable data structure that represents
expectations on module M
capabilities.
A Model[M, I, A]
represents a capability of module M
that takes an
input I
and returns an effect that may produce a single A
.
A MockException
is used internally by the mock framework to
signal failed expectations to the test framework.
The Mockable[A]
represents a mock service builder used by the mock
framework to construct a mock implementation from a mock.
A ReturnExpectation[-I, E, +A]
represents an expectation on output for capability of module M
that given input arguments I
returns an effect that may fail with an error E
or produce a single A
.
A
Expectation[-M, +E, +A]
is an immutable data structure that represents expectations on moduleM
capabilities.This structure is a monad, because we need the sequential composability and in Scala we get the convenient for-comprehension syntax for free.
Empty
models expectation for no calls, the monadicunit
valueCall
models a call onM
modules capability that takes argumentsI
and returns an effect that may fail with an errorE
or produce a singleA
FlatMap
models sequential composition of expectationsThe whole structure is not supposed to be consumed directly by the end user, instead it should be converted into a mocked environment (wrapped in Managed) either explicitly via
managedEnv
method or via implicit conversion.