Skip to content

No issue ( java.lang.StringIndexOutOfBoundsException: String index out of range: -9) #20

@misrakli

Description

@misrakli

I added a very simple activity with a very simple layout and i get following exception when running the test.

java.lang.StringIndexOutOfBoundsException: String index out of range: -9
at java.lang.String.substring(String.java:1954)
at org.robolectric.res.ResName.qualifyResName(ResName.java:51)
at org.robolectric.shadows.ShadowAssetManager$StyleResolver.getParent(ShadowAssetManager.java:466)
at org.robolectric.shadows.ShadowAssetManager$StyleResolver.getAttrValue(ShadowAssetManager.java:415)
at org.robolectric.shadows.ShadowResources.getOverlayedThemeValue(ShadowResources.java:295)
at org.robolectric.shadows.ShadowResources.attrsToTypedArray(ShadowResources.java:134)
at org.robolectric.shadows.ShadowResources.access$000(ShadowResources.java:51)
at org.robolectric.shadows.ShadowResources$ShadowTheme.obtainStyledAttributes(ShadowResources.java:489)
at android.content.res.Resources$Theme.obtainStyledAttributes(Resources.java)
at android.content.Context.obtainStyledAttributes(Context.java:472)
at android.view.View.__constructor__(View.java:3677)
at android.view.View.<init>(View.java)

The layout is very simple (empty).

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/myId"/>
</LinearLayout>

The Test is only creating the activity.

@RunWith(CustomTestRunner.class)
@Config(constants = BuildConfig.class)
public class TestSimpleActivity
{
 @Test
public void test()
{
    SimpleActivity activity =  Robolectric.buildActivity(SimpleActivity.class).create().start().resume().visible().get();

    Assert.assertEquals(true, "test".equals("fail"));
}
}

Any ideas or suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions