Created
August 23, 2020 17:02
-
-
Save Audhil/5e7a9efecf7e56a5296c3626fd8e1e63 to your computer and use it in GitHub Desktop.
instrumentation tests - Test equivalent of app module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
@InstallIn(ApplicationComponent::class) | |
class TestAPIModule { | |
@Provides | |
fun giveRetrofitAPIService(): API = | |
Retrofit.Builder() | |
.baseUrl("http://localhost:8080/") | |
// .baseUrl("http://127.0.0.1:8080") // this too works | |
.addConverterFactory(MoshiConverterFactory.create()) | |
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) | |
.build() | |
.create(API::class.java) | |
@Provides | |
fun giveTestScheduler(): TestScheduler? = null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment