a17fa1bf849545e31e51d62845d251005fdf2978.svn-base 766 B

12345678910111213141516171819202122232425262728
  1. package com.example.myapplication;
  2. import android.content.Context;
  3. import androidx.test.platform.app.InstrumentationRegistry;
  4. import androidx.test.ext.junit.runners.AndroidJUnit4;
  5. import org.junit.Test;
  6. import org.junit.runner.RunWith;
  7. import static org.junit.Assert.*;
  8. /**
  9. * Instrumented test, which will execute on an Android device.
  10. *
  11. * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
  12. */
  13. @RunWith(AndroidJUnit4.class)
  14. public class ExampleInstrumentedTest {
  15. @Test
  16. public void useAppContext() {
  17. // Context of the app under test.
  18. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
  19. assertEquals("com.example.myapplication", appContext.getPackageName());
  20. }
  21. }