package Ġme . tat ark a . inject . test Ċ Ċ import Ġassert k . assertThat Ċ import Ġassert k . assertions . is Same As Ċ import Ġme . tat ark a . inject . annotations . Component Ċ import Ġme . tat ark a . inject . annotations . Inject Ċ import Ġme . tat ark a . inject . annotations . Provides Ċ import Ġme . tat ark a . inject . test . different . Different Package Foo Ċ import Ġkotlin . test . Test Ċ Ċ @ Inject Ċ object ĠFoo Object Ċ Ċ @ Inject Ċ class ĠDep ends On Foo Object ( val Ġfoo : ĠFoo Object ) Ċ Ċ @ Component Ċ abstract Ġclass ĠObject Component Ġ{ ĊĠĠĠ Ġabstract Ġval Ġinject Object : ĠFoo Object ĊĠĠĠ Ġabstract Ġval Ġdifferent Package Object : ĠDifferent Package Foo . My Object ĊĠĠĠ Ġabstract Ġfun Ġinject Object 2 (): ĠFoo Object ĊĠĠĠ Ġabstract Ġfun Ġdepends On Foo Object 2 (): ĠDep ends On Foo Object Ċ } Ċ Ċ interface ĠComp anion Foo Interface Ċ Ċ interface ĠComp anion Foo Ġ{ ĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġcompanion Ġobject Ġ: ĠComp anion Foo Interface Ċ } Ċ Ċ @ Inject Ċ class ĠDepend On Companion Foo ( val Ġfoo : ĠComp anion Foo Interface ) Ċ Ċ @ Component Ċ abstract Ġclass ĠComp anion Object Component Ġ{ ĊĠĠĠ Ġabstract Ġval Ġfoo : ĠComp anion Foo Interface ĊĠĠĠ Ġabstract Ġval Ġdepends On Foo : ĠDepend On Companion Foo ĊĊĠĠĠ Ġval ĠComp anion Foo . Companion . bind : ĠComp anion Foo Interface ĊĠĠĠĠĠĠĠ Ġ@ Provides Ġget () Ġ= Ġthis Ċ } Ċ Ċ class ĠInject Object Test Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinject _ annotated _ object _ can _ be _ provided _ in _ component _ function () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcomponent Ġ= ĠObject Component :: class . create () ĊĠĠĠĠĠĠĠ ĠassertThat ( component . inject Object 2 ()). is Same As ( Foo Object ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinject _ annotated _ object _ can _ be _ provided _ in _ component _ property () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcomponent Ġ= ĠObject Component :: class . create () ĊĠĠĠĠĠĠĠ ĠassertThat ( component . inject Object ). is Same As ( Foo Object ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinject _ annotated _ object _ can _ be _ provided _ to _ class _ construct ors () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcomponent Ġ= ĠObject Component :: class . create () ĊĠĠĠĠĠĠĠ ĠassertThat ( component . depends On Foo Object 2 (). foo ). is Same As ( Foo Object ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinject _ annotated _ object _ can _ be _ provided _ from _ a _ different _ package () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcomponent Ġ= ĠObject Component :: class . create () ĊĠĠĠĠĠĠĠ ĠassertThat ( component . different Package Object ). is Same As ( Different Package Foo . My Object ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbind s _ a _ comp anion _ object _ to _ an _ interface () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcomponent Ġ= ĠComp anion Object Component :: class . create () ĊĊĠĠĠĠĠĠĠ ĠassertThat ( component . foo ). is Same As ( Companion Foo ) ĊĠĠĠĠĠĠĠ ĠassertThat ( component . depends On Foo . foo ). is Same As ( Companion Foo ) ĊĠĠĠ Ġ} Ċ }