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