Please see responses from here: https://github.com/robolectric/robolectric/issues/1041
Change your pull to refresh initialization from onCreate into onStart or to onViewCreated (for fragment). Worked for me.
Question
I'm trying to implement some TDD using Robolectric(2.3-20140416.035220-155) on an activity that uses AppCompat and chrisbanes/ActionBar-PullToRefresh library.
Nevertheless, I'm getting the following error:
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)
And the following lines repeats itself at the stack trace:
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)
This is my setup
configuration:
@Before
public void setup() {
activity = Robolectric.buildActivity(MainActivity.class).create().visible().start().resume().get();
}
Is there any special configuration that I must add, or just Robolectric is not currently compatible with chrisbanes library?
Thanks,
Solution
Please see responses from here: https://github.com/robolectric/robolectric/issues/1041
Change your pull to refresh initialization from onCreate into onStart or to onViewCreated (for fragment). Worked for me.