Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcinOz/a1035c86f6e06ab4c97f4b2d2543a9b8 to your computer and use it in GitHub Desktop.
Save marcinOz/a1035c86f6e06ab4c97f4b2d2543a9b8 to your computer and use it in GitHub Desktop.
private fun mockFetchMovieDiscover(block: SingleEmitter<MovieDiscoveryResponse>.() -> Unit) {
`when`(dataProvider.getMovieDiscover()).thenReturn(Single.create { e -> e.block() })
}
@Test
fun fetchMovieDiscover_test_success_with_empty() {
mockFetchMovieDiscover { onSuccess(emptyList()) }
viewModel.fetchMovieDiscover()
verify(observer).onChanged(LoadingState())
verify(observer).onChanged(EmptyState())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment