So here is the overview of my project: module A contains: - all boxstore data - boxstore mock for unit tests in module A
module B contains: - presenter that has BoxStore injected - presenterTest needs to mock BoxStore
Followed this link to mock BoxStore and it works fine when I wrote unit tests in module A. When it comes to creating the mock in module B I get NoClassDefFoundError which I understand since module B tests don't know about module A test objects.
So I did the following scenarios:
- Added in gradle of module B:
sourceSets { test.java.srcDirs += [etc...] }
So that module B would know about mock objects of module A.
- Duplicate mock of BoxStore in module B and use it in tests but BoxStore generates a java file under build folder and because of that I'm unable to create my mock since everything depends on MyObjectBox in order to generate a BoxStore.
Both methods failed :(
Any ideas on how I can unblock myself?