Skip to content

Instantly share code, notes, and snippets.

@jeffypooo
Created November 6, 2015 19:48
Show Gist options
  • Save jeffypooo/f4e899215174e376ef45 to your computer and use it in GitHub Desktop.
Save jeffypooo/f4e899215174e376ef45 to your computer and use it in GitHub Desktop.
Unit Test setup for code using Parse's Android SDK
@RunWith(RobolectricTestRunner.class)
@Config(manifest = TestConstants.MOBILE_ROBOLECTRIC_MANIFEST_PATH, sdk = 21)
public abstract class ParseTestBase {
static boolean parseInit = false;
@Before
public void setup() throws ParseException {
if (!parseInit) {
Context context = ShadowApplication.getInstance().getApplicationContext();
Parse.enableLocalDatastore(context);
Parse.initialize(context, "<app-id-here>", "<client-key-here>");
ParseUser.enableAutomaticUser();
parseInit = true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment