lundi 28 septembre 2015

Unit testing using the real implementation (classes)

I'm wondering if there is a way to avoid mocking some classes. I'm working on a bigger unit testing thing related with notifications. I run into multiple issues which I was able to fix mostly.

Now I'm stuck with some classes like PendingIntent, Notification.Builder and probably even Notification. I'm using the compat library so I cannot inject my code to mock everything. I even have no idea how to mock a builder pattern.

Could you give me a reference how I can avoid that Android Studio injects the dummy objects which return null on every call? I would like to white list some classes. I mean I know that some classes are easy to mock like Intent or SharedPreferences.

Aucun commentaire:

Enregistrer un commentaire