title: How to test an IntentService with Robolectric?
body: <p>I'm trying to test the <code>onHandleIntent()</code> method of an <code>IntentService</code> using <code>Robolectric</code>.</p>
  
  <p>I'm starting the service with:</p>
  
  <pre><code>Activity activity = new Activity();
  Intent intent = new Intent(activity, MyService.class);
  activity.startService(intent);
  
  ShadowActivity shadowActivity = Robolectric.shadowOf(activity);
  Intent startedIntent = shadowActivity.getNextStartedService();
  assertNotNull(startedIntent);
  </code></pre>
  
  <p>seems like <code>startedIntent</code> is not null, but <code>onHandleIntent()</code> doesn't seem to be called.</p>
  
  <p>how should I test it ?</p>