sealed trait Expectation[-M, +E, +A] extends AnyRef
An Expectation[-M, +E, +A] is an immutable data structure that represents
expectations on module M capabilities.
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 Managed)
either explicitly via managedEnv method or via implicit conversion.
- Self Type
- Expectation[M, E, A]
- Alphabetic
- By Inheritance
- Expectation
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
*>[M1 <: M, E1 >: E, B](that: Expectation[M1, E1, B]): Expectation[M1, E1, B]
A variant of
flatMapthat ignores the value returned by this expectation. -
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
flatMap[M1 <: M, E1 >: E, B](k: (A) ⇒ Expectation[M1, E1, B]): Expectation[M1, E1, B]
Returns an expectation that models the execution of this expectation, followed by passing of its value to the specified continuation function
k, followed by the expectation that it returns.Returns an expectation that models the execution of this expectation, followed by passing of its value to the specified continuation function
k, followed by the expectation that it returns.{{ val mockClock = (MockClock.sleep(equalTo(1.second)) returns unit).flatMap(_ => MockClock.nanoTime returns value(5L)) }}
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
managedEnv[M1 <: M](implicit mockable: Mockable[M1]): Managed[Nothing, M1]
Converts this Expectation to ZManaged mock environment.
-
final
def
map[B](f: (A) ⇒ B): Expectation[M, E, Nothing]
Returns empty expectation.
Returns empty expectation.
This is required for the for-comprehension syntax.
- Annotations
- @silent( ... )
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
zipRight[M1 <: M, E1 >: E, B](that: Expectation[M1, E1, B]): Expectation[M1, E1, B]
A named alias for
*>