Created
September 15, 2017 13:45
-
-
Save flipper83/12c75e770dd45b6003ebcdaf173ae02e to your computer and use it in GitHub Desktop.
injection
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
//MainActivity.java | |
public class MainActivity extends BaseActivity implements SuperHeroesPresenter.View { | |
@Inject SuperHeroesPresenter presenter; | |
/* ... */ | |
} | |
//MainModule.java | |
@Module public class MainModule { | |
@Provides @Singleton public SuperHeroesRepository provideSuperHeroesRepository() { | |
return new SuperHeroesRepository(); | |
} | |
} | |
//MainActivityTest | |
@RunWith(AndroidJUnit4.class) @LargeTest public class MainActivityTest { | |
private static final int ANY_NUMBER_OF_SUPER_HEROES = 100; | |
@Rule public DaggerMockRule<MainComponent> daggerRule = | |
new DaggerMockRule<>( | |
/* ... */ | |
); | |
@Mock SuperHeroesRepository repository; | |
/* ... */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment