I have a Robolectric test case written as
public void setUp(){
mActivity = new CalcActivity();
ShadowActivity shadow = Robolectric.shadowOf(mActivity);
//more code
But i'm getting a RuntimeException : Stub!
at the very start of the setUp method.
java.lang.RuntimeException: Stub!
at android.content.Context.<init>(Context.java:4)
at android.content.ContextWrapper.<init>(ContextWrapper.java:5)
at android.view.ContextThemeWrapper.<init>(ContextThemeWrapper.java:5)
at android.app.Activity.<init>(Activity.java:6)
at com.example.advancedcalc.CalcActivity.<init>(CalcActivity.java:13)
at com.example.CalcActivityTest.setUp(CalcActivityTest.java:25)
CalcActivity implements an OnclickListener and it has a bunch of other methods that perform basic calculator operations inside.
Can anyone tell me why i'm getting java.lang.RuntimeException: Stub!
and how to deal with it ?
Have you added
@RunWith(RobolectricTestRunner.class)
as an annotation to your test class?