WindowSdkExtensionsRule


public final class WindowSdkExtensionsRule implements TestRule


TestRule for overriding WindowSdkExtensions properties in unit tests.

The TestRule is designed to only be used in unit tests. Users should use the actual WindowSdkExtensions properties for instrumentation tests. Overriding the device's extensions version to a higher version may lead to unexpected test failures or even app crash.

Summary

Public constructors

Public methods

@NonNull Statement
apply(@NonNull Statement base, @NonNull Description description)
final void
overrideExtensionVersion(@IntRange(from = 0) int version)

Overrides the WindowSdkExtensions.extensionVersion for testing.

Public constructors

WindowSdkExtensionsRule

Added in 1.4.0-alpha01
public WindowSdkExtensionsRule()

Public methods

apply

Added in 1.4.0-alpha01
public @NonNull Statement apply(@NonNull Statement base, @NonNull Description description)

overrideExtensionVersion

Added in 1.4.0-alpha01
public final void overrideExtensionVersion(@IntRange(from = 0) int version)

Overrides the WindowSdkExtensions.extensionVersion for testing.

Parameters
@IntRange(from = 0) int version

The extension version to override.