### Question:
PushService extends Service { void setPushHandler(PushHandler handler) { this.handler = handler; } PushService(); @Override void onCreate(); @Override int onStartCommand(final Intent intent, int flags, final int startId); @Override IBinder onBind(Intent intent); @Override void onDestroy();  }### Answer:
@Test public void testStartCommand() throws Exception { controller.create(); service.setPushHandler(handler); final TaskCompletionSource<Void> tcs = new TaskCompletionSource<>(); final Task<Void> handleTask = tcs.getTask(); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { tcs.setResult(null); return null; } }).when(handler).handlePush(any(Intent.class)); controller.startCommand(0, 0); handleTask.waitForCompletion(); verify(callbacks, times(1)).onServiceCreated(service); verify(handler, times(1)).handlePush(any(Intent.class)); }