本文整理汇总了Java中org.robolectric.shadows.support.v4.SupportFragmentTestUtil.startFragment方法的典型用法代码示例。如果您正苦于以下问题:Java SupportFragmentTestUtil.startFragment方法的具体用法?Java SupportFragmentTestUtil.startFragment怎么用?Java SupportFragmentTestUtil.startFragment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robolectric.shadows.support.v4.SupportFragmentTestUtil
的用法示例。
在下文中一共展示了SupportFragmentTestUtil.startFragment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
DummyDataSet.copyDataSet("ASDB_Tabs.db");
helper = new SQLChatHelper(context);
cHelper = new SQLContactHelper(context);
fragment = ChatTabFragment.createInstance();
SupportFragmentTestUtil.startFragment(fragment);
adapter = new ChatTabRecyclerAdapter(fragment);
presenter = new ChatTabPresenter(fragment, adapter);
Contact c1 = new Contact("kontakt1");
Contact c2 = new Contact("kontakt2");
List<Contact> cList = new ArrayList<>();
cList.add(c1);
cList.add(c2);
Chat chat = new Chat("TestChat", "1", cList);
helper.insert(chat);
}
示例2: setupFragment
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
private void setupFragment(int environment) {
List<EnvironmentModel> environments = Lists.newArrayList(
newEnvironmentModel(123, "A-environment"),
newEnvironmentModel(environment, "B-environment"),
newEnvironmentModel(10, "C-environment"),
newEnvironmentModel(789, "D-environment"));
when(environmentService.findAll()).thenReturn(Observable.just(environments));
DeviceListFragment fragment = new DeviceListFragment();
Bundle args = new Bundle();
args.putInt(ARG_ENVIRONMENT, environment);
fragment.setArguments(args);
SupportFragmentTestUtil.startFragment(fragment);
assertNotNull("should not be null", fragment);
}
示例3: setUpFragment
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
private void setUpFragment() {
postsFragment = new PostsFragment();
SupportFragmentTestUtil.startFragment(postsFragment);
postsFragment.setPresenter(postsPresenterMock);
postsFragment.postsRecyclerView = postsRecyclerViewMock;
postsFragment.postRecyclerViewAdapter = postRecyclerViewAdapterMock;
postsFragment.progressDialog = progressDialogMock;
}
示例4: testOnSaveInstanceStateDelegated
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testOnSaveInstanceStateDelegated() {
SupportFragmentTestUtil.startFragment(fragment);
final Bundle testBundle = new Bundle();
fragment.onSaveInstanceState(testBundle);
verify(fragment.getMvvmDelegate()).onSaveInstanceState(testBundle);
}
示例5: testRemoveOnPropertyChangedCallbacksOnActivityDestroy
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testRemoveOnPropertyChangedCallbacksOnActivityDestroy() {
final Observable.OnPropertyChangedCallback firstCallback = mock(Observable.OnPropertyChangedCallback.class);
final Observable.OnPropertyChangedCallback secondCallback = mock(Observable.OnPropertyChangedCallback.class);
fragment.setViewModel(fragment.createViewModel());
fragment.addOnPropertyChangedCallback(firstCallback);
fragment.addOnPropertyChangedCallback(secondCallback);
SupportFragmentTestUtil.startFragment(fragment);
fragment.onDestroy();
verify(fragment.getViewModel()).removeOnPropertyChangedCallback(firstCallback);
verify(fragment.getViewModel()).removeOnPropertyChangedCallback(secondCallback);
}
示例6: testSwipeCardOrder3
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testSwipeCardOrder3() {
CardFragmentTestClass fragment = new CardFragmentTestClass();
SupportFragmentTestUtil.startFragment(fragment, EmptyActivity.class);
ArrayList<Professional> test_data_set = new ArrayList<Professional>(128);
for (int i = 0; i < 128; ++i)
test_data_set.add(ProfessionalTestClass.testProfessional("" + Integer.toString(i), "" + Integer.toString(i)));
fragment.setTestData(test_data_set, CardFragmentTestClass.Test.mix);
//SearchQueryResult cardSet;
// cardSet = fragment.getCurrentSet();
ShadowLog.stream = System.out;
ShadowLog.i("", "\n- - - - - - - - - - - - - - - - - - - - - - - - -\n");
iterator = 50;
ShadowLog.i("testSwipeCardOrder3", "forward and backward iterations inside same set");
assert1ForwardIteration(fragment, test_data_set);
assert1ForwardIteration(fragment, test_data_set);
assert1BackwardIteration(fragment, test_data_set);
assert1ForwardIteration(fragment, test_data_set);
assert1ForwardIteration(fragment, test_data_set);
assert1ForwardIteration(fragment, test_data_set);
assert1BackwardIteration(fragment, test_data_set);
assert1BackwardIteration(fragment, test_data_set);
ShadowLog.i("testSwipeCardOrder3", "forward and backward iterations alternating sets");
//iterator=52
for (int i = 0; i < 30; ++i) assert1ForwardIteration(fragment, test_data_set);
for (int i = 0; i < 30; ++i) assert1BackwardIteration(fragment, test_data_set);
for (int i = 0; i < 30; ++i) assert1ForwardIteration(fragment, test_data_set);
for (int i = 0; i < 30; ++i) assert1BackwardIteration(fragment, test_data_set);
}
示例7: setUp
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
DummyDataSet.copyDataSet("ASDB_Tabs.db");
fragment = ContactTabFragment.createInstance();
SupportFragmentTestUtil.startFragment(fragment);
adapter = new ContactTabRecyclerAdapter(fragment);
presenter = new ContactTabPresenter(fragment, adapter);
contactHelper = HelperFactory.getContacHelper(context);
chatHelper = HelperFactory.getChatHelper(context);
}
示例8: setUp
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
DummyDataSet.copyDataSet("ASDB_Tabs.db");
ShadowLog.stream = System.out;
fileHelper = new SQLFileHelper(context);
chatHelper = new SQLChatHelper(context);
dataHelper = new SQLDataHelper(context);
fragment = FileTabFragment.createInstance();
SupportFragmentTestUtil.startFragment(fragment);
adapter = new FileTabRecyclerAdapter(fragment);
presenter = new FileTabPresenter(fragment, adapter);
}
示例9: updateProjects_SetsAdapter
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test public void updateProjects_SetsAdapter() throws Exception {
fragment = ProjectListFragment.newInstance();
SupportFragmentTestUtil.startFragment(fragment);
fragment.updateProjects(getProjects());
//assertThat(fragment.recyclerView).hasAdapter();
RecyclerView.Adapter adapter = fragment.recyclerView.getAdapter();
assertThat(adapter).isNotNull();
assertThat(adapter.getItemCount()).isEqualTo(2);
}
示例10: testOnCreateView
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testOnCreateView() throws Exception {
// execute
SupportFragmentTestUtil.startFragment(fixture);
// validate
assertNotNull(fixture);
verify(scanner).update();
verify(scanner).register(fixture.getChannelGraphAdapter());
}
示例11: testOnResume
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testOnResume() throws Exception {
// setup
SupportFragmentTestUtil.startFragment(fixture);
// execute
fixture.onResume();
// validate
verify(scanner, times(2)).update();
}
示例12: testOnDestroy
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testOnDestroy() throws Exception {
// setup
SupportFragmentTestUtil.startFragment(fixture);
// execute
fixture.onDestroy();
// validate
verify(scanner).unregister(fixture.getChannelGraphAdapter());
}
示例13: testOnCreateView
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testOnCreateView() throws Exception {
// execute
SupportFragmentTestUtil.startFragment(fixture);
// validate
assertNotNull(fixture);
verify(scanner).update();
verify(scanner).register(fixture.getChannelRatingAdapter());
}
示例14: testOnDestroy
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testOnDestroy() throws Exception {
// setup
SupportFragmentTestUtil.startFragment(fixture);
// execute
fixture.onDestroy();
// validate
verify(scanner).unregister(fixture.getChannelRatingAdapter());
}
示例15: testOnCreateView
import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testOnCreateView() throws Exception {
// execute
SupportFragmentTestUtil.startFragment(fixture);
// validate
assertNotNull(fixture);
verify(scanner).update();
verify(scanner).register(fixture.getAccessPointsAdapter());
}