GooglePlayMessengerCallback implements JobCallback { @Override public void jobFinished(@JobResult int status) { try { messenger.send(createResultMessage(status)); } catch (RemoteException e) { throw new RuntimeException(e); } } GooglePlayMessengerCallback(Messenger messenger, String tag); @Override void jobFinished(@JobResult int status);  }
@Test public void jobFinished() throws Exception { final ArgumentCaptor<Message> messageCaptor = ArgumentCaptor.forClass(Message.class); callback.jobFinished(JobService.RESULT_SUCCESS); Mockito.verify(messengerMock).send(messageCaptor.capture()); Message message = messageCaptor.getValue(); assertEquals(GooglePlayMessageHandler.MSG_RESULT, message.what); assertEquals(JobService.RESULT_SUCCESS, message.arg1); assertEquals("tag", message.getData().getString(REQUEST_PARAM_TAG)); }