From 007a81e78b3b7d6880bb00f0be7ae4f59e165f1b Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 18 Nov 2025 15:09:26 +0800 Subject: [PATCH] 11 --- .../ExampleInstrumentedTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/src/androidTest/java/test/shangyu/cn/myapplication/ExampleInstrumentedTest.java diff --git a/app/src/androidTest/java/test/shangyu/cn/myapplication/ExampleInstrumentedTest.java b/app/src/androidTest/java/test/shangyu/cn/myapplication/ExampleInstrumentedTest.java new file mode 100644 index 0000000..bc81932 --- /dev/null +++ b/app/src/androidTest/java/test/shangyu/cn/myapplication/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package test.shangyu.cn.myapplication; + +import android.content.Context; +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("test.shangyu.cn.myapplication", appContext.getPackageName()); + } +}