Skip to content

Instantly share code, notes, and snippets.

@mcatta
Created March 22, 2020 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcatta/d468efa58dd1f95af6ff26a19154b18e to your computer and use it in GitHub Desktop.
Save mcatta/d468efa58dd1f95af6ff26a19154b18e to your computer and use it in GitHub Desktop.
Test rx java return
@Test
fun `test fetchDataViaRX with an empty result`() {
every { dataRepository.fetchDataWithRX() } returns Single.just(listOf())
mainPresenter.fetchData()
val captureData = slot<List<UiDataModel>>()
verify(exactly = 1) { view.onResult(capture(captureData)) }
captureData.captured.let { res ->
assertNotNull(res)
assert(res.isEmpty())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment