android / codelab-android-dagger

Apache License 2.0
181 stars 157 forks source link

Fix FakeStorage reference error on TestStorageModule (issue #78) #80

Open reisfernanda opened 11 months ago

reisfernanda commented 11 months ago

This PR fixes the issue #78.

TestStorageModule from androidTest shows an unresolved reference error for FakeStorage on the TestStorageModule class, even though the instrumented tests run successfully.

Screenshot 2023-11-03 at 11 22 21 AM

FakeStorage is located at the sharedTest package, and this package is shared with tests through sourceSets, but it looks like sharing code this way is not supported anymore, according to this comment on Google Issue Tracker..

This PR creates a new module called shared-test with the FakeStorage class and adds it as a dependency for unit and instrumented tests on the app module. With this change, the Fake Storage on the TestStorageModule class is referenced correctly.