guys, one question: I’m using Mockito with my kotl...
# announcements
f
guys, one question: I’m using Mockito with my kotlin classes but it only works to mock interfaces .. If i make a class open and try to mock it it gives me a null poiinter: For instance, I have this class :
Copy code
import 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:
Copy code
@Test
fun myTest() {
       val appVersion = "my-app-version"
        Mockito.`when` (appMetadata.getAppVersion())
                .thenReturn(appVersion)
}
Does someone know how to work-around this?