FakeLifecycleManager


public final class FakeLifecycleManager


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

Summary

Nested types

public enum FakeLifecycleManager.State extends Enum

Set of possible states of the runtime.

Public constructors

Public methods

final void

Allows an additional call to update to not be blocked.

void

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

void

Executes the Runtime initialization logic.

final @NonNull FakeLifecycleManager.State

The current state of the runtime.

final @NonNull TestTimeSource

The time source used for this runtime.

void

Pauses execution while retaining the state in memory.

void

Resumes execution from a paused or init state.

void

Stops the execution and releases all resources.

@NonNull ComparableTimeMark

Retrieves the latest timemark.

Public constructors

FakeLifecycleManager

Added in 1.0.0-alpha01
public FakeLifecycleManager()

Public methods

allowOneMoreCallToUpdate

Added in 1.0.0-alpha01
public final void allowOneMoreCallToUpdate()

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
public void configure()

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
public void create()

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

getState

Added in 1.0.0-alpha01
public final @NonNull FakeLifecycleManager.State getState()

The current state of the runtime.

getTimeSource

Added in 1.0.0-alpha01
public final @NonNull TestTimeSource getTimeSource()

The time source used for this runtime.

pause

Added in 1.0.0-alpha01
public void pause()

Pauses execution while retaining the state in memory.

resume

Added in 1.0.0-alpha01
public void resume()

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
public void stop()

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

public @NonNull ComparableTimeMark update()

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