Skip to content

Instantly share code, notes, and snippets.

@Foxpace
Last active July 3, 2023 20:44
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 Foxpace/9a4e26b5fff588c9b55d466cd1c8d360 to your computer and use it in GitHub Desktop.
Save Foxpace/9a4e26b5fff588c9b55d466cd1c8d360 to your computer and use it in GitHub Desktop.
Turbine example test
@RunWith(JUnit4::class)
class TurbineViewModelTest {
// 1.
@Mock
lateinit var heavyComputation: HeavyComputationTemplate
// 2.
@get:Rule
val mockitoRule: MockitoRule = MockitoJUnit.rule()
@Test
fun `Given the sut is initialized, then it waits for event`() {
// 3.
val sut = ExampleViewModel(heavyComputation)
// 4.
assertTrue(sut.vmState.value == VmState.Waiting)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment