DaggerMock icon indicating copy to clipboard operation
DaggerMock copied to clipboard

realworldappInjector: cant ad the modules into the component.builder due to error

Open jonneymendoza opened this issue 7 years ago • 4 comments
trafficstars

Hi i am getting the following error following your example

error: @Component.Builder has setters for modules or components that aren't required:

this happens when i add the following line to my component like in your example realworldappInjector project

/*used for daggerMock for instrumentalTests */ fun accountModule(accountModule: AccountModule): Builder

    fun mainModule(mainModule: MainModule): Builder

jonneymendoza avatar May 31 '18 14:05 jonneymendoza

edit: if i dont add that to my component.builder, i get this error:

Error invoking setter with parameter class Module on object Component.

Any suggestions? trying to use daggermock with espresso and using 0.8.4

jonneymendoza avatar Jun 01 '18 09:06 jonneymendoza

Hi, are you defining the MainModule in the module attribute of the @Component annotation? Removing the definition in the example I get the same error

fabioCollini avatar Jun 03 '18 21:06 fabioCollini

Hi that seem to work when i added MainModule to the @Cmponent annotation, however the mocks from my actual test class never gets injected using this rule and instead just uses the default injected values

jonneymendoza avatar Jun 05 '18 13:06 jonneymendoza

Can you provide more info? Do you get any error? Which test are you writing, jvm or espresso? Are you using kotlin and are you using a library to open the classes?

fabioCollini avatar Jun 07 '18 20:06 fabioCollini