Skip to content

Instantly share code, notes, and snippets.

@sanogueralorenzo
Created March 24, 2018 19:21
Show Gist options
  • Save sanogueralorenzo/e17675cdd6df7dd03032c9a64ea36275 to your computer and use it in GitHub Desktop.
Save sanogueralorenzo/e17675cdd6df7dd03032c9a64ea36275 to your computer and use it in GitHub Desktop.
class CounterViewModelTest {
private lateinit var viewModel: CounterViewModel
@Rule
@JvmField
val instantTaskExecutorRule: TestRule = InstantTaskExecutorRule()
@Before
fun setUp() {
viewModel = CounterViewModel()
}
@Test
fun clickingButtonIncreasesCounter() {
// given
// when
viewModel.onButtonClick()
// then
assertEquals(1, viewModel.counter.value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment