Last active
February 29, 2016 01:14
-
-
Save supercoffee/32b754beb01c5f5043b2 to your computer and use it in GitHub Desktop.
Robolectric Test Class Template for Android Studio
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
#* | |
How to use this template: | |
Open up the preferences menu in Android studio. | |
Navigate to Editor > File and Code Templates | |
Click the green + button above the templates tab | |
Name the template whatever you want. Make sure that it has "java" as an extension. | |
Paste this whole thing in the text area. | |
Click Ok. | |
This template will appear when you invoke the "New" context menu in the project pane. | |
*# | |
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end | |
import junit.framework.TestCase; | |
import org.junit.runner.RunWith; | |
import org.robolectric.RobolectricGradleTestRunner; | |
import org.robolectric.annotation.Config; | |
@RunWith(RobolectricGradleTestRunner.class) | |
@Config(constants = BuildConfig.class, sdk = 21) | |
public class ${NAME} { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment