Android Robolectric和chrisbanes/ActionBar PullToRefresh活性测试

Android Robolectric和chrisbanes/ActionBar PullToRefresh活性测试,android,robolectric,pull-to-refresh,Android,Robolectric,Pull To Refresh,我试图在使用AppCompat和chrisbanes/ActionBar PullToRefresh库的活动上使用Robolectric(2.3-20140416.035220-155)实现一些TDD 然而,我得到了以下错误: java.lang.StackOverflowError at java.security.AccessController.doPrivileged(Native Method) at org.fest.reflect.util.Accessibles.

我试图在使用AppCompat和chrisbanes/ActionBar PullToRefresh库的活动上使用Robolectric(2.3-20140416.035220-155)实现一些TDD

然而,我得到了以下错误:

java.lang.StackOverflowError
    at java.security.AccessController.doPrivileged(Native Method)
    at org.fest.reflect.util.Accessibles.setAccessible(Accessibles.java:57)
    at org.fest.reflect.util.Accessibles.setAccessibleIgnoringExceptions(Accessibles.java:36)
    at org.fest.reflect.method.Invoker.invoke(Invoker.java:118)
    at org.robolectric.bytecode.ShadowWrangler.shadowOf(ShadowWrangler.java:434)
    at org.robolectric.Robolectric.shadowOf_(Robolectric.java:1027)
    at org.robolectric.Robolectric.shadowOf(Robolectric.java:457)
    at org.robolectric.Robolectric.getShadowApplication(Robolectric.java:1259)
    at org.robolectric.shadows.ShadowLooper.getMainLooper(ShadowLooper.java:59)
    at android.os.Looper.getMainLooper(Looper.java)
    at org.robolectric.Robolectric.getUiThreadScheduler(Robolectric.java:1251)
    at org.robolectric.shadows.ShadowView.post(ShadowView.java:318)
    at android.view.View.post(View.java)
以下行在堆栈跟踪处重复:

    at uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher$2.run(PullToRefreshAttacher.java:131)
    at org.robolectric.util.Scheduler.postDelayed(Scheduler.java:37)
    at org.robolectric.util.Scheduler.post(Scheduler.java:42)
    at org.robolectric.shadows.ShadowView.post(ShadowView.java:318)
    at android.view.View.post(View.java)
这是我的
设置
配置:

@Before
public void setup() {
    activity = Robolectric.buildActivity(MainActivity.class).create().visible().start().resume().get();
}
是否有任何特殊的配置,我必须添加,或者只是Robolectric目前不兼容chrisbanes库


谢谢,

请查看以下回复:


将pull更改为将初始化从onCreate刷新为onStart或onViewCreated(对于片段)。为我工作。

我也遇到过同样的问题。现在我要做的是在intent中传递“isTesting”,并在活动中检查它,并且在测试时不使用任何pull来刷新逻辑。