@Test public void testSubmitSuccessful() { ((EditText) activity.findViewById(R.id.edittext_title)).setText("title"); ((EditText) activity.findViewById(R.id.edittext_content)).setText("http: shadowOf(activity).clickMenuItem(R.id.menu_send); ShadowAlertDialog.getLatestAlertDialog().getButton(DialogInterface.BUTTON_POSITIVE) .performClick(); verify(userServices).submit(any(Context.class), eq("title"), eq("http: eq(true), submitCallback.capture()); submitCallback.getValue().onDone(true); assertThat(shadowOf(activity).getNextStartedActivity()) .hasComponent(activity, NewActivity.class); assertThat(activity).isFinishing(); }
private void submit(boolean isUrl) { toggleControls(true); Toast.makeText(this, R.string.sending, Toast.LENGTH_SHORT).show(); mUserServices.submit(this, mTitleEditText.getText().toString(), mContentEditText.getText().toString(), isUrl, new SubmitCallback(this)); }
SubmitActivity extends InjectableActivity { private void submit(boolean isUrl) { toggleControls(true); Toast.makeText(this, R.string.sending, Toast.LENGTH_SHORT).show(); mUserServices.submit(this, mTitleEditText.getText().toString(), mContentEditText.getText().toString(), isUrl, new SubmitCallback(this)); } }
SubmitActivity extends InjectableActivity { private void submit(boolean isUrl) { toggleControls(true); Toast.makeText(this, R.string.sending, Toast.LENGTH_SHORT).show(); mUserServices.submit(this, mTitleEditText.getText().toString(), mContentEditText.getText().toString(), isUrl, new SubmitCallback(this)); }  }
SubmitActivity extends InjectableActivity { private void submit(boolean isUrl) { toggleControls(true); Toast.makeText(this, R.string.sending, Toast.LENGTH_SHORT).show(); mUserServices.submit(this, mTitleEditText.getText().toString(), mContentEditText.getText().toString(), isUrl, new SubmitCallback(this)); }  @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onPrepareOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); @Override void onBackPressed(); }
SubmitActivity extends InjectableActivity { private void submit(boolean isUrl) { toggleControls(true); Toast.makeText(this, R.string.sending, Toast.LENGTH_SHORT).show(); mUserServices.submit(this, mTitleEditText.getText().toString(), mContentEditText.getText().toString(), isUrl, new SubmitCallback(this)); }  @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onPrepareOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); @Override void onBackPressed();  }