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 fields

static final @NonNull List<@NonNull String>

Public constructors

FakeLifecycleManager(boolean hasCreatePermission)

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.

@NonNull Config

The current state of the runtime configuration.

final @NonNull FakeLifecycleManager.State

The current state of the runtime.

final @NonNull TestTimeSource

The time source used for this runtime.

final boolean

If false, create() will throw an exception during testing.

final boolean

If true, configure() will emulate the failure case for missing permissions.

void

Pauses execution while retaining the state in memory.

void

Resumes execution from a paused or init state.

void

The current state of the runtime configuration.

final void
setHasCreatePermission(boolean hasCreatePermission)

If false, create() will throw an exception during testing.

final void
setHasMissingPermission(boolean hasMissingPermission)

If true, configure() will emulate the failure case for missing permissions.

final void
setShouldSupportPlaneTracking(boolean shouldSupportPlaneTracking)

if false, configure() will throw an exception if the config enables PlaneTracking

final boolean

if false, configure() will throw an exception if the config enables PlaneTracking

void

Stops the execution and releases all resources.

@NonNull ComparableTimeMark

Retrieves the latest timemark.

Public fields

TestPermissions

public static final @NonNull List<@NonNull StringTestPermissions

Public constructors

FakeLifecycleManager

Added in 1.0.0-alpha04
public FakeLifecycleManager(boolean hasCreatePermission)

Public methods

allowOneMoreCallToUpdate

Added in 1.0.0-alpha04
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-alpha04
public void configure(@NonNull Config config)

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-alpha04
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.

getConfig

Added in 1.0.0-alpha04
public @NonNull Config getConfig()

The current state of the runtime configuration.

getState

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

The current state of the runtime.

getTimeSource

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

The time source used for this runtime.

hasCreatePermission

Added in 1.0.0-alpha04
public final boolean hasCreatePermission()

If false, create() will throw an exception during testing.

hasMissingPermission

Added in 1.0.0-alpha04
public final boolean hasMissingPermission()

If true, configure() will emulate the failure case for missing permissions.

pause

Added in 1.0.0-alpha04
public void pause()

Pauses execution while retaining the state in memory.

resume

Added in 1.0.0-alpha04
public void resume()

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

setConfig

Added in 1.0.0-alpha04
public void setConfig(@NonNull Config config)

The current state of the runtime configuration.

setHasCreatePermission

Added in 1.0.0-alpha04
public final void setHasCreatePermission(boolean hasCreatePermission)

If false, create() will throw an exception during testing.

setHasMissingPermission

Added in 1.0.0-alpha04
public final void setHasMissingPermission(boolean hasMissingPermission)

If true, configure() will emulate the failure case for missing permissions.

setShouldSupportPlaneTracking

Added in 1.0.0-alpha04
public final void setShouldSupportPlaneTracking(boolean shouldSupportPlaneTracking)

if false, configure() will throw an exception if the config enables PlaneTracking

shouldSupportPlaneTracking

Added in 1.0.0-alpha04
public final boolean shouldSupportPlaneTracking()

if false, configure() will throw an exception if the config enables PlaneTracking

stop

Added in 1.0.0-alpha04
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.