Я хочу отслеживать, выполняется ли вызов startService (...) в Activity:
public void testShouldCallServiceOnSendButtonPress() throws Exception {
assertNotNull(activity.pictureToSend);
ActivityMonitor androidMock = help.mockIntent(1);
TouchUtils.clickView(this, activity.sendButton);
help.assertBehavior(androidMock);
}
public ActivityMonitor mockIntent(int numberOfExpectedIntentsSentToAndroid) {
this.numberOfExpectedIntentsSentToAndroid = numberOfExpectedIntentsSentToAndroid;
IntentFilter intentFilter = null;
return androidMock = instrumentation.addMonitor(intentFilter, null, true);// catch all
}
выше. Я добавляю универсальный монитор (должен перехватывать и Activity, и Service, верно?!)
assertNotNull( this.startService(new Intent(this, MyService.class)) );
выше Я проверяю, что служба была успешно запущена, и это так.() не> = 1.
Есть идеи почему?