I want to provide downstream modules with test data/classes from an upstream module. What's the best way to do this?
Let's say I have the following modules:
:data-transactions -
Has an interface TransactionsCache. This module by default will provide a TransactionDbCache which backs this cache with SQLite.
:ui-transactions - requires an instance of TransactionsCache to display the transactions to the user. This module is dependant on :data-transactions.
What I want
- While testing
:ui-transactions, I want to provide a fake implementation ofTransactionsCache, likeTransactionsInMemoryCache. Other downstream modules of:data-transactionsmay needTransactionsInMemoryCachetoo. This class should NOT be included in non-test modules. - These test dependencies like
TransactionsInMemoryCacheshould be able to leverage kotlin theinternalvisibility modifier - i.e. be in the same module as:data-transactions
I'm guessing that the solution here is something to do with srcSets and a special testHelper configuration?
note: this is for android, so I'd need to generate an APK. is this possible without flavors?