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)
@UninstallModules(SearchModule::class, SearchResultsModule::class, DestinationsSearchModule::class)
@HiltAndroidTest
internal class MonthsFragmentTest
Tried writing an annotation that combines them
@UninstallModules(
SearchModule::class,
SearchResultsModule::class,
DestinationsSearchModule::class
)
@kotlin.annotation.Target
annotation class UninstallSearchProductionModules
and tried replacing them
@UninstallSearchProductionModules
@HiltAndroidTest
internal class MonthsFragmentTest