@Test public void testVote() { Intent intent = new Intent(); intent.putExtra(ItemActivity.EXTRA_ITEM, new TestHnItem(1)); controller = Robolectric.buildActivity(ItemActivity.class, intent); controller.create().start().resume(); activity = controller.get(); activity.findViewById(R.id.vote_button).performClick(); verify(userServices).voteUp(any(Context.class), eq("1"), userServicesCallback.capture()); userServicesCallback.getValue().onDone(true); assertEquals(activity.getString(R.string.voted), ShadowToast.getTextOfLatestToast()); }
private void vote(final WebItem story) { mUserServices.voteUp(ItemActivity.this, story.getId(), new VoteCallback(this)); }
ItemActivity extends InjectableActivity implements ItemFragment.ItemChangedListener { private void vote(final WebItem story) { mUserServices.voteUp(ItemActivity.this, story.getId(), new VoteCallback(this)); } }
ItemActivity extends InjectableActivity implements ItemFragment.ItemChangedListener { private void vote(final WebItem story) { mUserServices.voteUp(ItemActivity.this, story.getId(), new VoteCallback(this)); }  }
ItemActivity extends InjectableActivity implements ItemFragment.ItemChangedListener { private void vote(final WebItem story) { mUserServices.voteUp(ItemActivity.this, story.getId(), new VoteCallback(this)); }  @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onPrepareOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); @Override void onBackPressed(); @Override boolean onKeyDown(int keyCode, KeyEvent event); @Override boolean onKeyUp(int keyCode, KeyEvent event); @Override boolean onKeyLongPress(int keyCode, KeyEvent event); @Override void onWindowFocusChanged(boolean hasFocus); @Override void onItemChanged(@NonNull Item item); }
ItemActivity extends InjectableActivity implements ItemFragment.ItemChangedListener { private void vote(final WebItem story) { mUserServices.voteUp(ItemActivity.this, story.getId(), new VoteCallback(this)); }  @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onPrepareOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); @Override void onBackPressed(); @Override boolean onKeyDown(int keyCode, KeyEvent event); @Override boolean onKeyUp(int keyCode, KeyEvent event); @Override boolean onKeyLongPress(int keyCode, KeyEvent event); @Override void onWindowFocusChanged(boolean hasFocus); @Override void onItemChanged(@NonNull Item item); static final String EXTRA_ITEM; static final String EXTRA_CACHE_MODE; static final String EXTRA_OPEN_COMMENTS; }