mardi 6 janvier 2015

Robolectric: How can I set time that I want the Calendar class returns?

I have started to work with unit tests and still I do not know how to test somethings . My app has a method that receives 2 params, the opening and the closing time of a venue and returns true if the venue is open at the current time or false otherwise. Internally that method uses Calendar c = Calendar.getInstance(); to get the current time. To test properly that method, how can a set time that I want the Calendar class returns? I know that in Microsoft Fakes framework there is something called shims that fakes the return values of system classes. Do you know any similar technology in Robolectric framework?.


Aucun commentaire:

Enregistrer un commentaire