Skip to content

Instantly share code, notes, and snippets.

@minhwang
Created November 22, 2016 07:06
Show Gist options
  • Save minhwang/d89c13bda81d80342e13d59d11a3d2b8 to your computer and use it in GitHub Desktop.
Save minhwang/d89c13bda81d80342e13d59d11a3d2b8 to your computer and use it in GitHub Desktop.
package com.minhwang.myapplication;
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.minhwang.myapplication", appContext.getPackageName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment