Expectation

zio.mock.Expectation
See theExpectation companion object
sealed abstract class Expectation[R]

An Expectation[R] is an immutable tree structure that represents expectations on environment R.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def &&[R0 : Tag](that: Expectation[R0]): Expectation[R & R0]

Operator alias for and.

Operator alias for and.

Attributes

def ++[R0 : Tag](that: Expectation[R0]): Expectation[R & R0]

Operator alias for andThen.

Operator alias for andThen.

Attributes

def and[R0 : Tag](that: Expectation[R0]): Expectation[R & R0]

Compose two expectations, producing a new expectation to satisfy both.

Compose two expectations, producing a new expectation to satisfy both.

{{ val mockEnv = MockClock.sleep(equalTo(1.second)) and MockConsole.readLine(value("foo")) }}

Attributes

def andThen[R0 : Tag](that: Expectation[R0]): Expectation[R & R0]

Compose two expectations, producing a new expectation to satisfy both sequentially.

Compose two expectations, producing a new expectation to satisfy both sequentially.

{{ val mockEnv = MockClock.sleep(equalTo(1.second)) andThen MockConsole.readLine(value("foo")) }}

Attributes

def atLeast(min: Int): Expectation[R]

Lower-bounded variant of repeated, produces a new expectation to satisfy itself sequentially at least given number of times.

Lower-bounded variant of repeated, produces a new expectation to satisfy itself sequentially at least given number of times.

Attributes

def atMost(max: Int): Expectation[R]

Upper-bounded variant of repeated, produces a new expectation to satisfy itself sequentially at most given number of times.

Upper-bounded variant of repeated, produces a new expectation to satisfy itself sequentially at most given number of times.

Attributes

def exactly(times: Int): Expectation[R]

Produces a new expectation to satisfy itself exactly the given number of times.

Produces a new expectation to satisfy itself exactly the given number of times.

Attributes

Alias for atMost(1), produces a new expectation to satisfy itself at most once.

Alias for atMost(1), produces a new expectation to satisfy itself at most once.

Attributes

def or[R0 : Tag](that: Expectation[R0]): Expectation[R & R0]

Compose two expectations, producing a new expectation to satisfy one of them.

Compose two expectations, producing a new expectation to satisfy one of them.

{{ val mockEnv = MockClock.sleep(equalTo(1.second)) or MockConsole.readLine(value("foo")) }}

Attributes

def repeats(range: Range): Expectation[R]

Repeats this expectation within given bounds, producing a new expectation to satisfy itself sequentially given number of times.

Repeats this expectation within given bounds, producing a new expectation to satisfy itself sequentially given number of times.

val mockEnv = MockClock.sleep(equalTo(1.second)).repeats(1, 5)

NOTE: once another repetition starts executing, it must be completed in order to satisfy the composite expectation. For example (A ++ B).repeats(1, 2) will be satisfied by either A->B (one repetition) or A->B->A->B (two repetitions), but will fail on A->B->A (incomplete second repetition).

Attributes

Alias for exactly(3), produces a new expectation to satisfy itself exactly three times.

Alias for exactly(3), produces a new expectation to satisfy itself exactly three times.

Attributes

def toLayer(implicit trace: Trace): ULayer[R]

Converts this expectation to ZLayer.

Converts this expectation to ZLayer.

Attributes

def twice: Expectation[R]

Alias for exactly(2), produces a new expectation to satisfy itself exactly two times.

Alias for exactly(2), produces a new expectation to satisfy itself exactly two times.

Attributes

def ||[R0 : Tag](that: Expectation[R0]): Expectation[R & R0]

Operator alias for or.

Operator alias for or.

Attributes