TestNavigationEventDispatcherOwner


public final class TestNavigationEventDispatcherOwner implements NavigationEventDispatcherOwner


A test implementation of NavigationEventDispatcherOwner for verifying NavigationEventDispatcher interactions.

Use this class in tests to confirm that back-press fallbacks and callback status changes are invoked as expected. It tracks the number of times these events occur via public counters.

Summary

Public constructors

TestNavigationEventDispatcherOwner(
    @NonNull Function1<@NonNull TestNavigationEventDispatcherOwnerUnit> fallbackOnBackPressed,
    @NonNull Function1<@NonNull TestNavigationEventDispatcherOwnerUnit> onHasEnabledCallbacksChanged
)

Public constructors

TestNavigationEventDispatcherOwner

Added in 1.0.0-alpha05
public TestNavigationEventDispatcherOwner(
    @NonNull Function1<@NonNull TestNavigationEventDispatcherOwnerUnit> fallbackOnBackPressed,
    @NonNull Function1<@NonNull TestNavigationEventDispatcherOwnerUnit> onHasEnabledCallbacksChanged
)
Parameters
@NonNull Function1<@NonNull TestNavigationEventDispatcherOwnerUnit> fallbackOnBackPressed

A lambda invoked by the NavigationEventDispatcher when a back press occurs and no other callbacks handle it.

@NonNull Function1<@NonNull TestNavigationEventDispatcherOwnerUnit> onHasEnabledCallbacksChanged

A lambda invoked by the NavigationEventDispatcher when its NavigationEventDispatcher.hasEnabledCallbacks status changes.

Public methods

getFallbackOnBackPressedInvocations

Added in 1.0.0-alpha05
public final int getFallbackOnBackPressedInvocations()

The number of times NavigationEventDispatcher.fallbackOnBackPressed has been invoked.

getNavigationEventDispatcher

Added in 1.0.0-alpha05
public @NonNull NavigationEventDispatcher getNavigationEventDispatcher()

The NavigationEventDispatcher that should handle the navigation events.

getOnHasEnabledCallbacksChangedInvocations

Added in 1.0.0-alpha05
public final int getOnHasEnabledCallbacksChangedInvocations()

The number of times NavigationEventDispatcher.onHasEnabledCallbacksChanged has been invoked.