Skip to content

Instantly share code, notes, and snippets.

@BoxResin
Last active December 21, 2018 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoxResin/c5a7fbb1f8e3ac0031ec2cca4663c569 to your computer and use it in GitHub Desktop.
Save BoxResin/c5a7fbb1f8e3ac0031ec2cca4663c569 to your computer and use it in GitHub Desktop.
AndroidJUnit4 + Robolectric
package winapi251.app.schoolmeal
import android.content.Context
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest
{
@Test
fun useAppContext()
{
// Context of the app under test.
val appContext: Context = ApplicationProvider.getApplicationContext()
assertEquals("winapi251.app.schoolmeal", appContext.packageName)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment