TestClock

zio.test.TestClock$
See theTestClock companion trait
object TestClock extends Serializable

Attributes

Companion
trait
Graph
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
TestClock.type

Members list

Type members

Classlikes

final case class Data(instant: Instant, sleeps: List[(Instant, Promise[Nothing, Unit])], timeZone: ZoneId)

Data represents the state of the TestClock, including the clock time and time zone.

Data represents the state of the TestClock, including the clock time and time zone.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Sleep(duration: Duration, promise: Promise[Nothing, Unit], fiberId: FiberId)

Sleep represents the state of a scheduled effect, including the time the effect is scheduled to run, a promise that can be completed to resume execution of the effect, and the fiber executing the effect.

Sleep represents the state of a scheduled effect, including the time the effect is scheduled to run, a promise that can be completed to resume execution of the effect, and the fiber executing the effect.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed abstract class SuspendedWarningData

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Done.type
class Pending
object Start.type

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class Test(clockState: Atomic[Data], live: Live, annotations: Annotations, warningState: Synchronized[WarningData], suspendedWarningState: Synchronized[SuspendedWarningData]) extends TestClock, TestClockPlatformSpecific

Attributes

Supertypes
trait Product
trait Equals
trait TestClock
trait Restorable
trait Clock
trait Serializable
class Object
trait Matchable
class Any
Show all
sealed abstract class WarningData

WarningData describes the state of the warning message that is displayed if a test is using time by is not advancing the TestClock. The possible states are Start if a test has not used time, Pending if a test has used time but has not adjusted the TestClock, and Done if a test has adjusted the TestClock or the warning message has already been displayed.

WarningData describes the state of the warning message that is displayed if a test is using time by is not advancing the TestClock. The possible states are Start if a test has not used time, Pending if a test has used time but has not adjusted the TestClock, and Done if a test has adjusted the TestClock or the warning message has already been displayed.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Done.type
class Pending
object Start.type
object WarningData

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Value members

Concrete methods

def adjust(duration: => Duration)(implicit trace: Trace): UIO[Unit]

Accesses a TestClock instance in the environment and increments the time by the specified duration, running any actions scheduled for on or before the new time in order.

Accesses a TestClock instance in the environment and increments the time by the specified duration, running any actions scheduled for on or before the new time in order.

Attributes

def adjustWith[R, E, A](duration: => Duration)(zio: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
def live(data: Data)(implicit trace: Trace): ZLayer[Annotations & Live, Nothing, TestClock]

Constructs a new Test object that implements the TestClock interface. This can be useful for mixing in with implementations of other interfaces.

Constructs a new Test object that implements the TestClock interface. This can be useful for mixing in with implementations of other interfaces.

Attributes

def save(implicit trace: Trace): UIO[UIO[Unit]]

Accesses a TestClock instance in the environment and saves the clock state in an effect which, when run, will restore the TestClock to the saved state.

Accesses a TestClock instance in the environment and saves the clock state in an effect which, when run, will restore the TestClock to the saved state.

Attributes

def setTime(instant: => Instant)(implicit trace: Trace): UIO[Unit]

Accesses a TestClock instance in the environment and sets the clock time to the specified Instant, running any actions scheduled for on or before the new time in order.

Accesses a TestClock instance in the environment and sets the clock time to the specified Instant, running any actions scheduled for on or before the new time in order.

Attributes

def setTimeZone(zone: => ZoneId)(implicit trace: Trace): UIO[Unit]

Accesses a TestClock instance in the environment, setting the time zone to the specified time zone. The clock time in terms of nanoseconds since the epoch will not be altered and no scheduled actions will be run as a result of this effect.

Accesses a TestClock instance in the environment, setting the time zone to the specified time zone. The clock time in terms of nanoseconds since the epoch will not be altered and no scheduled actions will be run as a result of this effect.

Attributes

def sleeps(implicit trace: Trace): UIO[List[Instant]]

Accesses a TestClock instance in the environment and returns a list of times that effects are scheduled to run.

Accesses a TestClock instance in the environment and returns a list of times that effects are scheduled to run.

Attributes

def timeZone(implicit trace: Trace): UIO[ZoneId]

Accesses a TestClock instance in the environment and returns the current time zone.

Accesses a TestClock instance in the environment and returns the current time zone.

Attributes

Concrete fields

val any: ZLayer[TestClock, Nothing, TestClock]