Skip to content

Instantly share code, notes, and snippets.

@Audhil
Last active August 1, 2019 18:08
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 Audhil/4b7d967aef29a4d8c0df820152eca25d to your computer and use it in GitHub Desktop.
Save Audhil/4b7d967aef29a4d8c0df820152eca25d to your computer and use it in GitHub Desktop.
class AppRepositoryInjectTest {
@Inject
lateinit var appAPIs: AppAPIs
@Before
fun setUp() {
val component = DaggerTestAppComponent.builder()
.applicationModule(TestApplicationModule(GDelegate()))
.build()
component.into(this)
}
@Test
fun `my test`() {
assertNotNull(appAPIs)
/* Given */
every { appAPIs.getForecastTempWithUrl("r") } returns Flowable.just(APIResponse())
/* When */
val result = appAPIs.getForecastTempWithUrl("r")
/* Then */
result
.test()
.assertValue(APIResponse())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment