Java Code Examples for androidx.test.platform.app.InstrumentationRegistry#getTargetContext()

The following examples show how to use androidx.test.platform.app.InstrumentationRegistry#getTargetContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExampleInstrumentedTest.java    From hassalarm with MIT License 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.fjun.hassalarm", appContext.getPackageName());
}
 
Example 2
Source File: ExampleInstrumentedTest.java    From Flap with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("me.yifeiyuan.flap.test", appContext.getPackageName());
}
 
Example 3
Source File: ExampleInstrumentedTest.java    From smart-farmer-android with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.beanu.l2_shareutil", appContext.getPackageName());
}
 
Example 4
Source File: ExampleInstrumentedTest.java    From smart-farmer-android with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.beanu.sf", appContext.getPackageName());
}
 
Example 5
Source File: PopHoodActivityTest.java    From under-the-hood with Apache License 2.0 5 votes vote down vote up
@Test
public void testEmptyActivity() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("at.favre.lib.hood.test", appContext.getPackageName());
}
 
Example 6
Source File: ExampleInstrumentedTest.java    From android-popular-movies-app with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.example.android.popularmovies", appContext.getPackageName());
}
 
Example 7
Source File: ExampleInstrumentedTest.java    From CloudReader with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.example.jingbin.yunyue", appContext.getPackageName());
}
 
Example 8
Source File: ExampleInstrumentedTest.java    From image-zoom-view with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("ozaydin.serkan.com.imagezoom", appContext.getPackageName());
}
 
Example 9
Source File: ExampleInstrumentedTest.java    From Clock-view with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("edu.arbelkilani.eduarbelkilaniclock", appContext.getPackageName());
}
 
Example 10
Source File: ExampleInstrumentedTest.java    From MixPush with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.mixpush.vivopush.test", appContext.getPackageName());
}
 
Example 11
Source File: ExampleInstrumentedTest.java    From scratchCardLayout with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("in.codeshuffle.scratchcardview", appContext.getPackageName());
}
 
Example 12
Source File: ExampleInstrumentedTest.java    From HoverStarter with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.usehover.hoverstarter", appContext.getPackageName());
}
 
Example 13
Source File: ExampleInstrumentedTest.java    From iBeacon-Android with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.example.srikate.ibeacondemo", appContext.getPackageName());
}
 
Example 14
Source File: ExampleInstrumentedTest.java    From RichEditor with MIT License 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.yuruiyin.richeditor.test", appContext.getPackageName());
}
 
Example 15
Source File: ExampleInstrumentedTest.java    From MixPush with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.mixpush.gcm.test", appContext.getPackageName());
}
 
Example 16
Source File: ExampleInstrumentedTest.java    From MetalDetector with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.yeliheng.metaldetector", appContext.getPackageName());
}
 
Example 17
Source File: ExampleInstrumentedTest.java    From RackMonthPicker with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.rackspira.kristiawan.datemonthdialog.test", appContext.getPackageName());
}
 
Example 18
Source File: ExampleInstrumentedTest.java    From NCalendar with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("necer.ncalendardemo", appContext.getPackageName());
}
 
Example 19
Source File: ExampleInstrumentedTest.java    From RackMonthPicker with Apache License 2.0 5 votes vote down vote up
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.rackspira.kristiawan.monthpickerdialog", appContext.getPackageName());
}
 
Example 20
Source File: MicrosubTest.java    From indigenous-android with GNU General Public License v3.0 4 votes vote down vote up
@After
public void tearDown() throws Exception {
    super.tearDown();
    Context context = (InstrumentationRegistry.getTargetContext());
    TestUtils.removeAccount(context, launchedActivity);
}