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

Public methods

final int

The number of times NavigationEventDispatcher.fallbackOnBackPressed has been invoked.

@NonNull NavigationEventDispatcher

The NavigationEventDispatcher that should handle the navigation events.

Public constructors

TestNavigationEventDispatcherOwner

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

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

Public methods

getFallbackOnBackPressedInvocations

Added in 1.0.0-alpha07
public final int getFallbackOnBackPressedInvocations()

The number of times NavigationEventDispatcher.fallbackOnBackPressed has been invoked.

getNavigationEventDispatcher

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

The NavigationEventDispatcher that should handle the navigation events.