Created
May 25, 2018 06:59
-
-
Save kikuchy/de7344dd9c9577cd714f344a61c2c60c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app/src/test/(java|kotlin))/(package名)/ExampleUnitTest.kt | |
@RunWith(AndroidJUnit4::class) | |
class ExampleUnitTest { | |
@Test | |
fun useAppContext() { | |
val context = InstrumentationRegistry.getTargetContext() | |
val sp = context.getSharedPreferences("hoge", Context.MODE_PRIVATE) | |
sp.edit().putBoolean("hoge", true).apply() | |
assertTrue(sp.getBoolean("hoge", false)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment