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