findData

inline fun <T : Transmission.Data> findData(predicate: (T) -> Boolean): T?

Finds the first data transmission of the specified type that matches the predicate.

Return

The first matching data transmission, or null if none found

Example:

val errorData = findData<ApiData> { it.hasError }
assertNotNull(errorData)
assertEquals("Network timeout", errorData.errorMessage)

Parameters

T

The type of data to search for

predicate

Function to test each data transmission