Get context of test project in Android junit test case

后端 未结 10 2226
闹比i
闹比i 2020-12-02 12:58

Does anyone know how can you get the context of the Test project in Android junit test case (extends AndroidTestCase).

Note: The test is NOT instru

10条回答
  •  生来不讨喜
    2020-12-02 13:13

    If you want to get the context with Kotlin and Mockito, you can do it in the following way:

    val context = mock(Context::class.java)
    

    I Hope its help you

提交回复
热议问题