I have several test classes that are annotated by ...
# dagger
a
I have several test classes that are annotated by
HiltAndroidTest
and they have
UninstallModules
with the same set of modules to uninstall. If I add or remove an extra module to uninstall, I have to cascade the changes to the rest. Is there a way to avoid repeating myself with Hilt or do I need to file a feature request for that? What I tried and didn't work (inspired by Spring Boot TestComponent annotation)
Copy code
@UninstallModules(SearchModule::class, SearchResultsModule::class, DestinationsSearchModule::class)
@HiltAndroidTest
internal class MonthsFragmentTest
Tried writing an annotation that combines them
Copy code
@UninstallModules(
    SearchModule::class,
    SearchResultsModule::class,
    DestinationsSearchModule::class
)
@kotlin.annotation.Target
annotation class UninstallSearchProductionModules
and tried replacing them
Copy code
@UninstallSearchProductionModules
@HiltAndroidTest
internal class MonthsFragmentTest
a
Yeah it’s a limitation for now, there’s an existing issue in GitHub if you try to find it
a
Thanks for pointing out. In case someone is interested to read the issue. https://github.com/google/dagger/issues/1923