dimanche 2 août 2015

Rising error in Robolectric test when you have try-catch in your application code

In my android application I have written try-catch in every event method. So when an exception occurs, the catch gets the exception and a method shows a message box containing the exception details and I can handle and find my application's bugs.

For example:

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {

} 
catch (Exception e) {
        MessageBox.showException(this, e);
    }

}

Now in Robolectric which there is no device to show the ui results, I cannot find out if an exception occurred. Now I want to do something when my code went to catch part or when MessageBox.showException is called, the test fails.

How can I do that?

Aucun commentaire:

Enregistrer un commentaire