I have a method in my class i want to test which shows an alert dialog . When i call this method from the test class it is executed but the dialog is not shown? The same happens when i call a method, that shows some toast or other popup dialog my test class extends ActivityInstrumentationTestCase2.
public void showSaveName(String name){
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_menu_save)
.setTitle(R.string.savePopupLabel)
.setMessage(R.string.savePopupMessage)
.setPositiveButton(R.string.save_yes, new alter(name))
.setNegativeButton(R.string.save_no, null)
.show();
}
when i call this from my test class
getActivity().showSaveName(name);
the dialog is not shown? Can anyone help me to figure out why it is happening ?or if i am doing something wrong?