-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
51 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
17 changes: 15 additions & 2 deletions
17
...le/src/main/java/com/example/scanner_example/di/ScannerFeatureDependenciesFakeModule.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
package com.example.scanner_example.di; | ||
|
||
import com.example.core.di.general.PerFeature; | ||
import com.example.core_db_api.data.DbClientApi; | ||
import com.example.core_network_api.data.HttpClientApi; | ||
import com.example.purchase_api.domain.PurchaseInteractor; | ||
import com.example.scanner_example.fake.DbClientFake; | ||
import com.example.scanner_example.fake.HttpClientFake; | ||
import com.example.scanner_example.fake.PurchaseInteractorFake; | ||
|
||
import dagger.Binds; | ||
import dagger.Module; | ||
import dagger.Provides; | ||
|
||
@Module | ||
public class ScannerFeatureDependenciesFakeModule { | ||
public abstract class ScannerFeatureDependenciesFakeModule { | ||
|
||
@Provides | ||
@PerFeature | ||
public PurchaseInteractor purchaseInteractor() { | ||
public static PurchaseInteractor purchaseInteractor() { | ||
return new PurchaseInteractorFake(); | ||
} | ||
|
||
@PerFeature | ||
@Binds | ||
public abstract DbClientApi provideDbClientApi(DbClientFake dbClient); | ||
|
||
@PerFeature | ||
@Binds | ||
public abstract HttpClientApi provideHttpClientApi(HttpClientFake httpClientFake); | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
feature-scanner-example/src/main/java/com/example/scanner_example/fake/DbClientFake.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.example.scanner_example.fake; | ||
|
||
import com.example.core_db_api.data.DbClientApi; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class DbClientFake implements DbClientApi { | ||
|
||
@Inject | ||
public DbClientFake() { | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
feature-scanner-example/src/main/java/com/example/scanner_example/fake/HttpClientFake.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.example.scanner_example.fake; | ||
|
||
import com.example.core_network_api.data.HttpClientApi; | ||
|
||
import javax.inject.Inject; | ||
|
||
import io.reactivex.Single; | ||
|
||
public class HttpClientFake implements HttpClientApi { | ||
|
||
@Inject | ||
public HttpClientFake() { | ||
} | ||
|
||
@Override | ||
public Single<Object> doAnyRequest() { | ||
return Single.just(new Object()); | ||
} | ||
|
||
} |