How can we access context of an application in Robolectric?

后端 未结 14 1499
既然无缘
既然无缘 2020-12-05 03:32

Actually, I need to get a response of an API call, for that I required Context.

14条回答
  •  伪装坚强ぢ
    2020-12-05 04:29

    It is safer to use Robolectric.getShadowApplication() instead of using Robolectric.application directly.

提交回复
热议问题