Skip to content

Instantly share code, notes, and snippets.

@maskaravivek
Created May 17, 2018 19:01
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 maskaravivek/fc9abb66e6950470e9cef718635671b0 to your computer and use it in GitHub Desktop.
Save maskaravivek/fc9abb66e6950470e9cef718635671b0 to your computer and use it in GitHub Desktop.
class TestExamplesApplication : ExamplesApplication() {
override fun initAppComponent(): AppComponent {
return DaggerAppComponent.builder()
.appModule(MockApplicationModule(this))
.build()
}
@Module
private inner class MockApplicationModule internal constructor(application: Application) : AppModule(application) {
override fun provideUserService(context: Context): UserService {
val mock = Mockito.mock(UserService::class.java)
`when`(mock!!.displayUserName("Test")).thenReturn("Hello Test!")
return mock
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment