square / assertj-android

A set of AssertJ helpers geared toward testing Android.
https://square.github.io/assertj-android/
Apache License 2.0
1.58k stars 156 forks source link

TabLayoutAssert.hasTabMode throws an exception #171

Closed arturdm closed 9 years ago

arturdm commented 9 years ago

Calling TabLayoutAssert.hasTabMode() on a TabLayout with more than 1 tab:

TabLayout tabLayout = (TabLayout) mainActivity.findViewById(R.id.tab_layout);
assertThat(tabLayout).hasTabMode(TabLayout.MODE_FIXED);

throws an exception. Here's the stacktrace:

java.lang.IllegalStateException: Unknown value: 2
    at org.assertj.android.internal.IntegerUtils$NamedValueStringBuilder.get(IntegerUtils.java:74)
    at org.assertj.android.design.api.widget.TabLayoutAssert.modeToString(TabLayoutAssert.java:64)
    at org.assertj.android.design.api.widget.TabLayoutAssert.hasTabMode(TabLayoutAssert.java:42)
    at org.assertj.android.design.api.widget.TabLayoutAssert.hasFixedTabs(TabLayoutAssert.java:48)
    at com.dicedmelon.MainActivityTest.shouldHaveFixedTabs(MainActivityTest.java:25)
arturdm commented 9 years ago

170 should fix this