pivotal/robolectric — Issue #193: NullPointerException in TestAttributeSet
Author: karussell
Created: 2012-02-10 12:52:36+00:00
State: open

Here is the exception **

Here is the code:

class OverviewActivity extends ListActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.overview);

Here is the test code:

OverviewActivity overview = new OverviewActivity();
overview.onCreate(null);

Probably this problem is due to the fact that I've several components and a listview in one listactivity:

...

**
Caused by: java.lang.NullPointerException
at com.xtremelabs.robolectric.tester.android.util.TestAttributeSet.getAttributeResourceValue(TestAttributeSet.java:134)
at com.xtremelabs.robolectric.shadows.ShadowView.applyIdAttribute(ShadowView.java:672)
at com.xtremelabs.robolectric.shadows.ShadowView.applyAttributes(ShadowView.java:95)
at com.xtremelabs.robolectric.shadows.ShadowView.__constructor__(ShadowView.java:90)
at com.xtremelabs.robolectric.shadows.ShadowView.__constructor__(ShadowView.java:82)
at android.widget.ListView.(ListView.java)
at com.xtremelabs.robolectric.res.ViewLoader$ViewNode.constructView(ViewLoader.java:178)
at com.xtremelabs.robolectric.res.ViewLoader$ViewNode.create(ViewLoader.java:158)
at com.xtremelabs.robolectric.res.ViewLoader$ViewNode.inflate(ViewLoader.java:133)
at com.xtremelabs.robolectric.res.ViewLoader$ViewNode.inflate(ViewLoader.java:136)
at com.xtremelabs.robolectric.res.ViewLoader.inflateView(ViewLoader.java:102)
at com.xtremelabs.robolectric.res.ViewLoader.inflateView(ViewLoader.java:82)
at com.xtremelabs.robolectric.res.ViewLoader.inflateView(ViewLoader.java:86)
at com.xtremelabs.robolectric.res.ResourceLoader.inflateView(ResourceLoader.java:347)
at com.xtremelabs.robolectric.shadows.ShadowLayoutInflater.inflate(ShadowLayoutInflater.java:43)
at com.xtremelabs.robolectric.shadows.ShadowLayoutInflater.inflate(ShadowLayoutInflater.java:48)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at com.xtremelabs.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:105)
at android.app.Activity.setContentView(Activity.java)
at xy.activities.OverviewActivity.onCreate(OverviewActivity.java:52)