package mock
- Alphabetic
- Public
- All
Type Members
-
final
case class
ArgumentExpectation[-M, I, A](method: Method[M, I, A], assertion: Assertion[I]) extends Product with Serializable
An
ArgumentExpectation[M, I, A]represents an expectation on inputIarguments for capability of moduleMthat returns an effect that may produce a singleA. -
sealed
trait
Expectation[-M, +E, +A] extends AnyRef
An
Expectation[-M, +E, +A]is an immutable data structure that represents expectations on moduleMcapabilities.An
Expectation[-M, +E, +A]is an immutable data structure that represents expectations on moduleMcapabilities.This structure is a monad, because we need the sequential composability and in Scala we get the convenient for-comprehension syntax for free.
Emptymodels expectation for no calls, the monadicunitvalueCallmodels a call onMmodules capability that takes argumentsIand returns an effect that may fail with an errorEor produce a singleAFlatMapmodels sequential composition of expectations
The whole structure is not supposed to be consumed directly by the end user, instead it should be converted into a mocked environment (wrapped in layer) either explicitly via
toLayermethod or via implicit conversion. -
final
case class
Invocation[-M, I, A](method: Method[M, I, A], input: I, output: A) extends Product with Serializable
An
Invocation[M, I, A]models a single invocation of aMethod[M, I, A], including both the input to the method invocationIand the output from the method invocationA. -
trait
Method[-M, I, A] extends AnyRef
A
Model[M, I, A]represents a capability of moduleMthat takes an inputIand returns an effect that may produce a singleA. - trait Mock extends AnyRef
-
sealed
trait
MockException extends Throwable
A
MockExceptionis used internally by the mock framework to signal failed expectations to the test framework. -
trait
Mockable[A] extends AnyRef
The
Mockable[A]represents a mock service builder used by the mock framework to construct a mock implementation from a mock. -
sealed
trait
ReturnExpectation[-I, +E, +A] extends AnyRef
A
ReturnExpectation[-I, E, +A]represents an expectation on output for capability of moduleMthat given input argumentsIreturns an effect that may fail with an errorEor produce a singleA. -
trait
Spyable[A] extends Mockable[A]
Spyable[A]models the capability to spy on a service of typeA.Spyable[A]models the capability to spy on a service of typeA. Implementations must define both a methodenvironmentto genereate a live environment given a mock and a methodmockto generate a mock given a live environment. Given these definitions, it is possible to convert a service to a mock, see and modify state based on method calls, inputs, and outputs, and then convert the mock back to a live environment to spy on the service.
Value Members
- object Expectation
- object Mock
- object MockClock
- object MockConsole
- object MockException extends Serializable
- object MockRandom
- object MockSystem
- object ReturnExpectation
- object Spyable