Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Flipping the Koin @ GDG Dev Party

Flipping the Koin @ GDG Dev Party

Slides of my talk at GDG Dev Party Italy 2020

Roberto Orgiu

May 02, 2020
Tweet

More Decks by Roberto Orgiu

Other Decks in Programming

Transcript

  1. R O B E R T O O R G

    I U - @ _ t i w i z Flippin’ the Koin
  2. modules declaration val myModule = module { single<Target> { TargetImpl()

    } factory { (view: View) -> Presenter(view, get() } viewModel { MyViewModel(get()) } }
  3. Injection class MyWorker : KoinComponent { override suspend fun doWork():

    Result { val target: Target by inject() ... } }
  4. startKoin class MyTest : KoinTest { @Before fun setup() {

    startKoin { androidContext(context) modules(fetchModules()) } } }
  5. startKoin class MyTest : KoinTest { @Before fun setup() {

    startKoin { androidContext(context) modules(fetchModules()) } } }
  6. class MyTest : KoinTest { @Before fun setup() { startKoin

    {...} } @Test fun my_test() { } } private val target: Target by inject() declareMock<Target>() given(target).will { throw Exception() }