为什么以下测试会因标题中给出的错误而失败?
@RunWith(RobolectricTestRunner.class)
public class MainActivityTest {
private MainActivity mActivity;
@Before
public void setUp() {
mActivity = Robolectric.buildActivity(MainActivity.class).create().get();
}
@Test
public void testBaseballCardDetails() {
FragmentManager fm = mActivity.getSupportFragmentManager();
Fragment fragment = fm.findFragmentByTag(FragmentTags.EDIT_CARD);
assertThat(fragment).isNotNull().isAdded().isVisible();
}
}
答案 0 :(得分:0)
我似乎需要在visible()
上致电ActivityController
:
mActivity = Robolectric.buildActivity(MainActivity.class).create().visible().get();