I'm trying to test a piece of code using roboelectric and mockito framework that contains a handler.sendMessage(msg):
public void emailLogin(){
...
mHandler.sendMessage(message);
}
Handler mHandler = new Handler(new Callback() {
public boolean handleMessage(Message msg) {
System.out.println("called");
return false;
}
});
The handler works perfectly without normal envoirnment, but if I write a unit test for that method, the handler is not triggered.
Is the handler.sendMessage(msg) missing from robolectric? Or We have to test handler seperately?
I don't want to test the handler it self through a unit test, what I want to test is my function, that contains the handler.