knthmn
04/07/2021, 3:31 AMinterface Foo {
fun flowValue(): Flow<Value> // flow the stored value
suspend fun setValue(value: Value) // update the stored value
}
however the implementation is not for me to control, and sometimes flowValue()
sometimes emit the old value several times before emitting the set value. What is the best way to test this?setValue(bar)
flowValue().first { it == bar }
but it only deadlocks instead of failing when the implementation is wrong. The implementation contains Java threading too.louiscad
04/07/2021, 7:56 AMknthmn
04/07/2021, 9:54 AMlouiscad
04/07/2021, 9:55 AMuli
04/07/2021, 4:37 PMtimeout {}
louiscad
04/07/2021, 5:52 PMwithTimeout { … }
?