FakeLifecycleManager


class FakeLifecycleManager


Test-only implementation of LifecycleManager used to validate state transitions.

Summary

Nested types

Set of possible states of the runtime.

Public constructors

Public functions

Unit

Allows an additional call to update to not be blocked.

open Unit

Sets or changes the configuration to use, which will affect the availability of properties or features in other managers.

open Unit

Executes the Runtime initialization logic.

open Unit

Pauses execution while retaining the state in memory.

open Unit

Resumes execution from a paused or init state.

open Unit

Stops the execution and releases all resources.

open suspend ComparableTimeMark

Retrieves the latest timemark.

Public properties

FakeLifecycleManager.State

The current state of the runtime.

TestTimeSource

The time source used for this runtime.

Public constructors

FakeLifecycleManager

Added in 1.0.0-alpha01
FakeLifecycleManager()

Public functions

allowOneMoreCallToUpdate

Added in 1.0.0-alpha01
fun allowOneMoreCallToUpdate(): Unit

Allows an additional call to update to not be blocked. Requires that update has been called exactly once before each call to this method. Failure to do so will result in an IllegalStateException.

configure

Added in 1.0.0-alpha01
open fun configure(): Unit

Sets or changes the configuration to use, which will affect the availability of properties or features in other managers. It is necessary to have called create before calling this method.

create

Added in 1.0.0-alpha01
open fun create(): Unit

Executes the Runtime initialization logic. It is necessary to call resume after calling this method to start the runtime's execution logic.

pause

Added in 1.0.0-alpha01
open fun pause(): Unit

Pauses execution while retaining the state in memory.

resume

Added in 1.0.0-alpha01
open fun resume(): Unit

Resumes execution from a paused or init state. It is necessary to have called create before calling this method.

stop

Added in 1.0.0-alpha01
open fun stop(): Unit

Stops the execution and releases all resources. It is not valid to call any other method after calling stop. The runtime must not be resumed when this method is called.

update

open suspend fun update(): ComparableTimeMark

Retrieves the latest timemark. The first call to this method will execute immediately. Subsequent calls will be blocked until allowOneMoreCallToUpdate is called.

Public properties

state

Added in 1.0.0-alpha01
val stateFakeLifecycleManager.State

The current state of the runtime.

timeSource

Added in 1.0.0-alpha01
val timeSourceTestTimeSource

The time source used for this runtime.