Guest User

Untitled

a guest
Dec 14th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import android.app.Activity;
  2. import android.content.Context;
  3. import android.content.Intent;
  4. import android.test.ActivityUnitTestCase;
  5.  
  6. public class MainActivityUnitTest extends ActivityUnitTestCase<MainActivity> {
  7.  
  8. private Intent _startIntent;
  9.  
  10. public MainActivityUnitTest() {
  11. super(MainActivity.class);
  12. }
  13.  
  14. @Override
  15. protected void setUp() throws Exception {
  16. super.setUp();
  17.  
  18. Context targetContext = getInstrumentation().getTargetContext();
  19.  
  20. //Set your theme
  21. targetContext.setTheme(R.style.AppTheme);
  22.  
  23. setActivityContext(targetContext);
  24.  
  25. _startIntent = new Intent(Intent.ACTION_MAIN);
  26. }
  27.  
  28. public void testPreconditions() {
  29. startActivity(_startIntent, null, null);
  30. assertNotNull(getActivity());
  31. }
  32. }
Add Comment
Please, Sign In to add comment