Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Android/Testing/Unit Testing/Delegate Finals

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Methods such as 'showDialog()' are final, and cannot be overridden. Although Robolectric provides a means for you to change their implementation, it's sometimes convenient to use a simpler pattern - extending the class under test and overriding the new non-final method: public class MyActivity extends Activity { public void onResume(Bundle bundle) { Intent intent = getIntent(); int id = selectDialog(intent); boolean result = nonFinalShowDialog(id, bundle); } public boolean nonFinalShowDialog(int id, Bundle bundle) { return showDialog(id, bundle); } }