Created
August 24, 2015 08:57
-
-
Save CDRussell/b8f39b8fbb0df63b10f3 to your computer and use it in GitHub Desktop.
Base class to be used for all Robolectric unit tests.
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
package test; | |
import android.app.Application; | |
import com.tescobank.mobile.BuildConfig; | |
import org.junit.runner.RunWith; | |
import org.robolectric.RobolectricGradleTestRunner; | |
import org.robolectric.RuntimeEnvironment; | |
import org.robolectric.annotation.Config; | |
/** | |
* Base class to be used for all Robolectric unit tests. | |
* | |
* It is only necessary to extend this class for classes which touch Android; pure JUnit tests don't need to extend this. | |
*/ | |
@RunWith(RobolectricGradleTestRunner.class) | |
@Config(constants = BuildConfig.class) | |
public abstract class RobolectricUnitTest { | |
public Application getApplication() { | |
return RuntimeEnvironment.application; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment