TestFlowObserver

class TestFlowObserver<T>(flow: Flow<T>)

Allows you to record all observed values of a flow for easy testing.

Parameters

flow

The flow to observe.

Constructors

TestFlowObserver
Link copied to clipboard
common
fun <T> TestFlowObserver(flow: Flow<T>)
The flow to observe.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

awaitCount
Link copied to clipboard
common
fun awaitCount(count: Int, timeout: Long = 5000L)
Awaits until the specified count of elements has been received or the timeout is hit.
awaitCountSuspending
Link copied to clipboard
common
suspend fun awaitCountSuspending(count: Int, timeout: Long = 5000L)
Awaits until the specified count of elements has been received or the timeout is hit.
awaitFor
Link copied to clipboard
common
suspend fun awaitFor(timeout: Long = 5000L, condition: TestFlowObserver<T>.() -> Boolean)
Awaits until the specified condition is fulfilled or the timeout is hit.
close
Link copied to clipboard
common
fun close()
Closes the subscription on the underlying stream.
equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
toString
Link copied to clipboard
common
open fun toString(): String

Properties

values
Link copied to clipboard
common
val values: List<T>

Sources

(source)
Link copied to clipboard