FakeReachabilityGate

class FakeReachabilityGate(reachable: Boolean = true) : ReachabilityGate

A controllable ReachabilityGate for tests. Starts reachable (default true, so awaitReachable returns immediately); flip it with setReachable to make a pending awaitReachable resume. awaitCount records how many times the gate was awaited.

Constructors

Link copied to clipboard
constructor(reachable: Boolean = true)

Properties

Link copied to clipboard

How many times awaitReachable has been called.

Link copied to clipboard

Whether the gate currently reports connectivity.

Functions

Link copied to clipboard
open suspend override fun awaitReachable()
Link copied to clipboard
fun setReachable(reachable: Boolean)

Sets connectivity, resuming any coroutine suspended in awaitReachable when set to true.