use of org.robolectric.fakes.RoboMenuItem in project materialistic by hidroh.
the class ItemFragmentSinglePageTest method testShare.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Test
public void testShare() {
TestApplication.addResolver(new Intent(Intent.ACTION_SEND));
viewHolder.itemView.findViewById(R.id.button_more).performClick();
PopupMenu popupMenu = ShadowPopupMenu.getLatestPopupMenu();
assertNotNull(popupMenu);
shadowOf(popupMenu).getOnMenuItemClickListener().onMenuItemClick(new RoboMenuItem(R.id.menu_contextual_share));
assertThat(shadowOf(activity).getNextStartedActivity()).hasAction(Intent.ACTION_SEND);
}
use of org.robolectric.fakes.RoboMenuItem in project materialistic by hidroh.
the class FavoriteActivityTest method testVoteItemPromptToLogin.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Test
public void testVoteItemPromptToLogin() {
shadowAdapter.getViewHolder(0).itemView.findViewById(R.id.button_more).performClick();
PopupMenu popupMenu = ShadowPopupMenu.getLatestPopupMenu();
Assert.assertNotNull(popupMenu);
shadowOf(popupMenu).getOnMenuItemClickListener().onMenuItemClick(new RoboMenuItem(R.id.menu_contextual_vote));
verify(userServices).voteUp(any(Context.class), any(), userServicesCallback.capture());
userServicesCallback.getValue().onDone(false);
assertThat(shadowOf(activity).getNextStartedActivity()).hasComponent(activity, LoginActivity.class);
}
use of org.robolectric.fakes.RoboMenuItem in project android_packages_apps_Settings by LineageOS.
the class ManageApplicationsTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mAppReset = new RoboMenuItem(R.id.reset_app_preferences);
ReflectionHelpers.setStaticField(ApplicationsState.class, "sInstance", mState);
when(mState.newSession(any())).thenReturn(mSession);
mBgLooper = Looper.myLooper();
when(mState.getBackgroundLooper()).thenReturn(mBgLooper);
mFragment = new ManageApplications();
ReflectionHelpers.setField(mFragment, "mLifecycle", new Lifecycle());
}
use of org.robolectric.fakes.RoboMenuItem in project Detours-Android by TeamDetours.
the class Bar_NavDrawer_ActivityTest method onNavigationItemSelected_MilesIsTrue.
@Test
public void onNavigationItemSelected_MilesIsTrue() throws Exception {
MenuItem menuItem = new RoboMenuItem(R.id.nav_OneMile);
assertTrue(barActivity.onNavigationItemSelected(menuItem));
}
use of org.robolectric.fakes.RoboMenuItem in project Detours-Android by TeamDetours.
the class Bar_NavDrawer_ActivityTest method onOptionsItemSelectedRatings_AscIsTrue.
@Test
public void onOptionsItemSelectedRatings_AscIsTrue() throws Exception {
MenuItem menuItem = new RoboMenuItem(R.id.ratings_asc);
assertTrue(barActivity.onOptionsItemSelected(menuItem));
}
Aggregations