資源簡介
Android手電筒(Android studio版本)FlashLight,請直接導入源碼查看即可
代碼片段和文件信息
package?projects.flashlight;
import?android.content.Context;
import?android.support.test.InstrumentationRegistry;
import?android.support.test.runner.AndroidJUnit4;
import?org.junit.Test;
import?org.junit.runner.RunWith;
import?static?org.junit.Assert.*;
/**
?*?Instrumentation?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(“projects.flashlight“?appContext.getPackageName());
????}
}
評論
共有 條評論