ViewChildActivity extends BaseChildActivity { @Override protected void initializeView() { setContentView(R.layout.activity_register_child); findViewById(R.id.submit).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { edit(); } catch (JSONException e) { throw new RuntimeException(e); } } }); }  @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item);  }
@Test public void testEditListener() throws JSONException { doNothing().when(activity).edit(); activity.initializeView(); activity.findViewById(R.id.submit).performClick(); verify(activity).edit(); }