ActivityEmbeddingRule


public final class ActivityEmbeddingRule implements TestRule


A TestRule that will stub out the behavior of ActivityEmbeddingController and RuleController with a more simple one that will support testing independent of the current platform.

By default ActivityEmbeddingRule has values as if the developer has not opted in to the ActivityEmbedding feature. There are no set rules, and each Activity is not embedded.

Summary

Public constructors

Public methods

@NonNull Statement
apply(@NonNull Statement base, @NonNull Description description)
final void
overrideIsActivityEmbedded(
    @NonNull Activity activity,
    boolean isActivityEmbedded
)

Overrides the return value of ActivityEmbeddingController.isActivityEmbedded.

final void
overrideSplitInfo(
    @NonNull Activity activity,
    @NonNull List<@NonNull SplitInfo> splitInfoList
)

Overrides current split info reported by SplitController.splitInfoList.

final void

Overrides the return value of SplitController.splitSupportStatus.

Public constructors

ActivityEmbeddingRule

Added in 1.2.0
public ActivityEmbeddingRule()

Public methods

apply

Added in 1.2.0
public @NonNull Statement apply(@NonNull Statement base, @NonNull Description description)

overrideIsActivityEmbedded

Added in 1.2.0
public final void overrideIsActivityEmbedded(
    @NonNull Activity activity,
    boolean isActivityEmbedded
)

Overrides the return value of ActivityEmbeddingController.isActivityEmbedded.

Parameters
@NonNull Activity activity

Activity that will be passed to ActivityEmbeddingController.isActivityEmbedded.

boolean isActivityEmbedded

whether ActivityEmbeddingController.isActivityEmbedded should return true for the activity.

overrideSplitInfo

Added in 1.2.0
public final void overrideSplitInfo(
    @NonNull Activity activity,
    @NonNull List<@NonNull SplitInfo> splitInfoList
)

Overrides current split info reported by SplitController.splitInfoList. The initial override value is set to an empty List.

Parameters
@NonNull Activity activity

the Activity corresponding to the splitInfoList.

@NonNull List<@NonNull SplitInfo> splitInfoList

a list of SplitInfo that will be emitted through SplitController.splitInfoList.

overrideSplitSupportStatus

Added in 1.2.0
public final void overrideSplitSupportStatus(
    @NonNull SplitController.SplitSupportStatus status
)

Overrides the return value of SplitController.splitSupportStatus.

Parameters
@NonNull SplitController.SplitSupportStatus status

the global SplitController.SplitSupportStatus that will be returned instead.