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
public class MockTweeterActivityPview implements TweeterMVPPView { | |
public String fetchedTweet = null; | |
public List<String> previousTweets = null; | |
public boolean setUserButtonTextCalled = false; | |
public boolean toggleProgressBarCalled = false; | |
public boolean toggleLoginContainerCalled = false; | |
public String displayWebpage = null; | |
public boolean displayToastCalled = false; |
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
@RunWith(JUnit4.class) | |
public class MVPTest { | |
private static final String SOME_URL = "SOME_URL"; | |
private static final String USER_PASSWORD = "USER_PASSWORD"; | |
private static final String USER_NAME = "USER_NAME"; | |
@Inject | |
MockTweeterActivityPview pView; |
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
@RunWith(JUnit4.class) | |
public class MVVMTest { | |
private static final String SOME_URL = "SOME_URL"; | |
private static final String USER_PASSWORD = "USER_PASSWORD"; | |
private static final String USER_NAME = "USER_NAME"; | |
private String tweetedTweet; | |
@Inject | |
MainViewModel viewModel; |
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
@RunWith(AndroidJUnit4.class) | |
public class PlainTweeterTest { | |
@Rule | |
public ActivityTestRule<io.patrykpoborca.cleanarchitecture.ui.PlainTweeterActivity> plainTweeterActivity = new ActivityTestRule<>(io.patrykpoborca.cleanarchitecture.ui.PlainTweeterActivity.class, | |
false, | |
true); | |
private static final String SOME_URL = "SOME_URL"; | |
private static final String USER_PASSWORD = "USER_PASSWORD"; |
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
public class TestHelper { | |
private static ApplicationComponent sApplicationComponent; | |
private static BaseComponent sBaseComponent; | |
private static TestClassInjector sTestClassInjector; | |
public static ApplicationComponent getApplicationComponent(){ | |
if(sApplicationComponent == null) | |
{ | |
sApplicationComponent = DaggerApplicationComponent.builder() |
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
public class MockTweeterApi extends TweeterApi{ | |
public MockTweeterApi(Retrofit retrofit, LocalDataCache dataCache, Scheduler mainScheduler) { | |
super(retrofit, dataCache, mainScheduler); | |
} | |
@Override | |
public Observable<UserProfile> login(String username, String password) { | |
return Observable.just(new UserProfile(username, password)) | |
.observeOn(mainScheduler); | |
} |
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
public class MockLocalDataCache extends LocalDataCache { | |
public MockLocalDataCache(Context context) { | |
super(context); | |
} | |
@Override | |
public void saveTweet(String tweet) { | |
sPastTweets.add(tweet); | |
} |
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 | |
public class ThreadingModule { | |
@Named(Constants.MAIN_THREAD) | |
@Provides | |
public Scheduler providesMainThread(){ | |
return AndroidSchedulers.mainThread(); | |
} | |
} |
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
public class Retrofit { | |
protected OKHttp okHttp; | |
protected final Scheduler mainScheduler; | |
public Retrofit(OKHttp okHttp, Scheduler mainScheduler) { | |
this.okHttp = okHttp; | |
this.mainScheduler = mainScheduler; | |
} | |
public Observable<String> completeRequest(){ |
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 | |
public class NetworkModule { | |
@ApplicationScope | |
@Provides | |
protected OKHttp providesOkHTTP(){ | |
return new OKHttp(); | |
} | |
@ApplicationScope |