ViewChildActivity extends BaseChildActivity { protected void showSyncLog() { Toast.makeText(this, getText(R.string.temp_sync_error), Toast.LENGTH_LONG).show(); }  @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item);  }
@Test public void shouldShowSyncErrorLogIfSyncFailed() throws Exception { String syncError = "Actual Sync Error"; Child child = mock(Child.class); when(child.getSyncLog()).thenReturn(syncError); activity.child = child; activity.showSyncLog(); assertThat(ShadowToast.getTextOfLatestToast(), equalTo("Error occurred while syncing the record with the server, please try again.")); }