mardi 31 mai 2016

Mocking CountDownTimer and Handler

I'm using Mockito and PowerMockito to write my Unit Test on Android.

I've managed to work with almost all by back stuff, but I'm stuck with the CountDownTimer and Handler.

I'm able to mock a subclass of CountDownTimer, but I'm not able to mock it's final method like cancel(), so each time the cancel() method is called, the test runner report a java.lang.RuntimeException: Method cancel in android.os.CountDownTimer not mocked. See ...

Do anyone have a solution for this without using Robolectric?

Aucun commentaire:

Enregistrer un commentaire