TestPackageInstaller

class TestPackageInstaller @JvmOverloads constructor(sessionFactory: TestInstallSessionFactory = TestInstallSessionFactory.withScript( TestSessionScript.auto(Session.State.Succeeded) )) : PackageInstaller

An in-memory PackageInstaller test double.

Sessions are stored in memory and returned via ImmediateFuture from async accessors, which makes it suitable for deterministic JVM tests.

By default, creates sessions with TestSessionScript.auto, completing with Session.State.Succeeded.

Constructors

Link copied to clipboard
constructor(sessionFactory: TestInstallSessionFactory = TestInstallSessionFactory.withScript( TestSessionScript.auto(Session.State.Succeeded) ))
constructor(script: TestSessionScript<InstallFailure>)

Returns a TestPackageInstaller which creates all sessions with the provided script.

Properties

Link copied to clipboard

Returns a snapshot of all tracked sessions in the order they were added/created.

Functions

Link copied to clipboard

Clears all sessions in this repository.

Link copied to clipboard
open override fun createSession(parameters: InstallParameters): TestInstallSession
Link copied to clipboard
open override fun getSessionAsync(sessionId: UUID): ListenableFuture<TestInstallSession?>
Link copied to clipboard
Link copied to clipboard

Adds an existing session to this repository.