bj0
12/08/2017, 4:20 PMwhile / try / receive
you can just use a for
loop over channel
. As for testing, runBlocking
is generally used to make the function wait until the coroutines are done.koufa
12/09/2017, 11:06 AMconsumeEach
to not have to handle the close excpetion myself. But the question how to test this remains. I am using runBlocking
but I have an issue regarding the timing of mocking send
events to the channel
and the assertion on the LiveData
instance. @elizarov Do you have some suggestion on this?channel
and after the mocked send
calls I use close
and it works. I didnt knew that close
waits all items to be consumed before closing the channel