fabio.carballo
03/16/2016, 4:35 PMimport android.content.Context
class AppMetadata(val context: Context) {
fun getAppVersion() = context.packageManager.getPackageInfo(context.packageName, 0).versionName
}
and with this test it gives a null pointer:
@Test
fun myTest() {
val appVersion = "my-app-version"
Mockito.`when` (appMetadata.getAppVersion())
.thenReturn(appVersion)
}
Does someone know how to work-around this?