如何获取 Robolectric 中的上下文 3

How get the context in Robolectric 3

我可以通过这种方式访问​​ Robolectric 2.x 中的应用程序上下文,但不知道如何在 Robolectric 中访问 3.

return new ClassThatNeedsAContext(Robolectric.application.getApplicationContext());

[已编辑]
Robolectric 2.4 到 3.0 升级指南
https://github.com/robolectric/robolectric/wiki/2.4-to-3.0-Upgrade-Guide


[旧回复] 查看 Robolectric 的示例代码也许我找到了解决方案。 https://github.com/robolectric/robolectric/blob/f4935bff58ae6a16b1230c3a415973e97713c0fb/robolectric/src/test/java/org/robolectric/shadows/ViewInnerTextTest.java#L22

return new ClassThatNeedsAContext(RuntimeEnvironment.application);

但是我还有一些库的其他问题,所以我还不能测试它。