Skip to content

Instantly share code, notes, and snippets.

@adam-hurwitz
Last active October 4, 2020 01:32
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 adam-hurwitz/756a3defa9a577db74be30e92838cab6 to your computer and use it in GitHub Desktop.
Save adam-hurwitz/756a3defa9a577db74be30e92838cab6 to your computer and use it in GitHub Desktop.
Android Model-View-Intent with Unit Tests - FeedViewTest.kt Verify and Confirm
...
private lateinit var test: FeedViewTestCase
...
@ParameterizedTest
@MethodSource("FeedViewTestCaseStream")
fun `FeedView`(feedViewTestCase: FeedViewTestCase) = testCoroutineDispatcher.runBlockingTest {
test = feedViewTestCase
mockComponents(test)
val viewModel = FeedViewModel(...)
viewModel.bindIntents(object : FeedView {...})
...
verifyTest(test)
}
private fun verifyTest(test: FeedViewTestCase) {
coVerify {
repository.getMainFeedNetwork(any(), any())
}
confirmVerified(repository)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment