Skip to content

Instantly share code, notes, and snippets.

@mitrejcevski
Created December 17, 2019 09:11
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 mitrejcevski/4389bba710befc592026502012ab4488 to your computer and use it in GitHub Desktop.
Save mitrejcevski/4389bba710befc592026502012ab4488 to your computer and use it in GitHub Desktop.
private val loginModule = module {
val credentialsValidator = LoginCredentialsValidator()
val loginApi = InMemoryLoginApi()
val loginRepository = RemoteLoginRepository(loginApi)
viewModel {
LoginViewModel(credentialsValidator, loginRepository)
}
}
@Before
fun setUp() {
loadKoinModules(loginModule)
rule.launchActivity(Intent())
}
@Test
fun should_display_incorrect_credentials_error() {
onView(withId(R.id.loginUsername)).perform(typeText("username"))
onView(withId(R.id.loginPassword)).perform(typeText("password"))
onView(withId(R.id.loginButton)).perform(click())
onView(withId(R.id.textInfoLabel)).check(matches(withText("Incorrect Credentials")))
}
@After
fun tearDown() {
unloadKoinModules(loginModule)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment