我在下面收到一条错误消息,环顾四周,但是有一种解决方案可以解决。
How to test an IntentService with Robolectric?
java.lang.RuntimeException:java.lang.NoSuchMethodException: tapme.data.service.AlarmService。(java.lang.String)
这是我实施的单元测试-
@RunWith(RobolectricTestRunner.class)
public class AlarmServiceUnitTest {
private AlarmService service;
private IntentServiceController<AlarmService> controller;
@Before
public void setup() {
controller = Robolectric.buildIntentService(AlarmService.class).create();
service = controller.create().get();
}
@Test
public void alarmServiceShouldBeNotNull() {
assertNotNull(service);
}
}