Add a "testing mode" inject

Doesn't do anything currently, but will allow for Activities/etc. which can't be easily sub-classed, mocked, etc. during runs to modify behavior.
This commit is contained in:
Bradlee Speice
2014-07-07 23:28:28 -04:00
parent a15e78978b
commit 9548bb50ef
3 changed files with 51 additions and 3 deletions

View File

@ -2,8 +2,7 @@ package org.bspeice.minimalbible;
import android.app.Application;
import org.bspeice.minimalbible.activity.downloader.DownloadActivity;
import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Module;
@ -24,4 +23,17 @@ public class MinimalBibleModules {
Application provideApplication() {
return app;
}
/**
* This field allows us to set application-wide whether we are in a test or not
* Allows components on down the line to know whether they should set some things up or not.
* Additionally, not a Singleton so we can enable/disable testing mode as needed. However,
* for production, it's always false.
* @return Whether we are in a test - false
*/
@Provides
@Named("Testing")
boolean isTest() {
return false;
}
}