@Test public void testMissingInput() { shadowOf(activity).clickMenuItem(R.id.menu_send); ((EditText) activity.findViewById(R.id.edittext_title)).setText("title"); shadowOf(activity).clickMenuItem(R.id.menu_send); ((EditText) activity.findViewById(R.id.edittext_title)).setText(null); ((EditText) activity.findViewById(R.id.edittext_content)).setText("content"); verify(userServices, never()).submit(any(Context.class), any(), any(), anyBoolean(), any(UserServices.Callback.class)); assertThat(activity).isNotFinishing(); }
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();  }