Created
April 14, 2019 19:50
-
-
Save remcomokveld/475d14e91b2be5bd34857ad4ff9437c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(AndroidJUnit4::class) | |
class MyFragmentTest { | |
@Test | |
fun buttonIsEnabled() { | |
TestMyFragment.testViewModel = MyViewModel().also | |
it.updateState(enabled = true) | |
} | |
launchFragmentInContainer<TestMyFragment>() | |
onView(withId(R.id.button)).check(matches(isEnabled())) | |
} | |
@Test | |
fun buttonIsDisabled() { | |
TestMyFragment.testViewModel = MyViewModel().also | |
it.updateState(enabled = false) | |
} | |
launchFragmentInContainer<TestMyFragment>() | |
onView(withId(R.id.button)).check(matches(not(isEnabled()))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment