Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Context of the app under test. Context appContext = I… #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gitup21
Copy link

@gitup21 gitup21 commented Jun 1, 2021

…nstrumentationRegistry.getTargetContext(); assertEquals("p32929.myadslibapp", appContext.getPackageName()); } }

package p32929.myadslibapp;

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.*;

/**

  • Instrumented test, which will execute on an Android device.

  • @see Testing documentation
    */
    @RunWith(AndroidJUnit4.class)
    public class ExampleInstrumentedTest {
    @test
    public void useAppContext() {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

     assertEquals("p32929.myadslibapp", appContext.getPackageName());
    

    }
    }

…ationRegistry.getTargetContext(); assertEquals("p32929.myadslibapp", appContext.getPackageName()); } }

package p32929.myadslibapp;

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.*;

/**
 * Instrumented test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @test
    public void useAppContext() {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getTargetContext();

        assertEquals("p32929.myadslibapp", appContext.getPackageName());
    }
}
@p32929
Copy link
Owner

p32929 commented Aug 22, 2021

Hello, Sorry for the late reply. I didn't even know this pull request existed until today. Github does have a terrible way of finding own repo issues...

Btw, what does this pull request do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants