I have a class that sends a status bar notification in Android. I can't find a way to test whether the notification was sent or not, which makes it very hard to write any kind of useful unit test.
Does anyone have a solution for this?
I have a class that sends a status bar notification in Android. I can't find a way to test whether the notification was sent or not, which makes it very hard to write any kind of useful unit test.
Does anyone have a solution for this?
Try to create a Mock object by extending NotificationManager and override the notify() methods. The overridden functions can be asserted. In your test case(s), inject the Mock into the subject activity and run the tests using Android JUnit Test.