MultiGrantFakeManager

A GrantManager fake that behaves statefully across calls, unlike FakeGrantManager.

Calling request doesn't just return a canned value — it writes the result back into the status map, so a subsequent checkStatus for the same permission sees the post-request state. This matters for tests of code that requests a permission and then immediately re-checks it (e.g. a dev.brewkits.grant.GrantGroupHandler driving several permissions and re-evaluating which ones are still outstanding), where FakeGrantManager's stateless per-call return values would make every re-check look identical to the first one.

Prefer FakeGrantManager for most tests — reach for this one specifically when the behavior under test depends on status changing as a consequence of a request, not just on what the request returns.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Simulates a slow platform call — request suspends for this long first.

Link copied to clipboard

True once openSettings has been called.

Link copied to clipboard

Total number of times request has resolved, across every permission.

Functions

Link copied to clipboard
open suspend fun checkStatus(grant: <Error class: unknown class>): <Error class: unknown class>
Link copied to clipboard
fun configure(grant: <Error class: unknown class>, status: <Error class: unknown class>, requestResult: <Error class: unknown class> = status)

Sets both the pre-request status and the request outcome for grant in one call.

Link copied to clipboard
fun isRequestCalled(grant: <Error class: unknown class>): Boolean

True if request has been called for grant at least once.

Link copied to clipboard
open fun openSettings()
Link copied to clipboard
open suspend fun request(grant: <Error class: unknown class>): <Error class: unknown class>
open suspend fun request(grants: List<<Error class: unknown class>>): Map<<Error class: unknown class>, <Error class: unknown class>>
Link copied to clipboard
open fun setLauncher(launcher: <Error class: unknown class>)
Link copied to clipboard
fun setRequestResult(grant: <Error class: unknown class>, result: <Error class: unknown class>)

Sets what request resolves to for grant — checkStatus reflects this afterward too.

Link copied to clipboard
fun setStatus(grant: <Error class: unknown class>, status: <Error class: unknown class>)

Sets what checkStatus returns for grant until a request changes it.