TestContext

Companion:
class
class Object
trait Matchable
class Any

Type members

Classlikes

final class ConcurrentState(val currentID: AtomicLong, val currentNanos: AtomicLong, val tasks: ConcurrentSkipListSet[Task], val lastReportedFailure: AtomicReference[Throwable])
final case class State(lastID: Long, clock: FiniteDuration, tasks: SortedSet[Task], lastReportedFailure: Option[Throwable])

Used internally by TestContext, represents the internal state used for task scheduling and execution.

Used internally by TestContext, represents the internal state used for task scheduling and execution.

final case class Task(id: Long, task: Runnable, runsAt: FiniteDuration, rnd: Long)

Used internally by TestContext, represents a unit of work pending execution.

Used internally by TestContext, represents a unit of work pending execution.

Value members

Concrete methods

Builder for TestContext instances. Utilizes a random seed, which may be obtained from the TestContext#seed method.

Builder for TestContext instances. Utilizes a random seed, which may be obtained from the TestContext#seed method.

Constructs a new TestContext using the given seed, which must be encoded as base64. Assuming this seed was produced by another TestContext, running the same program against the new context will result in the exact same task interleaving as happened in the previous context, provided that the same tasks are interleaved. Note that subtle differences between different runs of identical programs are possible, particularly if one program auto-cedes in a different place than the other one. This is an excellent and reliable mechanism for small, tightly-controlled programs with entirely deterministic side-effects, and a completely useless mechanism for anything where the scheduler ticks see different task lists despite identical configuration.

Constructs a new TestContext using the given seed, which must be encoded as base64. Assuming this seed was produced by another TestContext, running the same program against the new context will result in the exact same task interleaving as happened in the previous context, provided that the same tasks are interleaved. Note that subtle differences between different runs of identical programs are possible, particularly if one program auto-cedes in a different place than the other one. This is an excellent and reliable mechanism for small, tightly-controlled programs with entirely deterministic side-effects, and a completely useless mechanism for anything where the scheduler ticks see different task lists despite identical configuration.