I just started to write Unit tests for Android code and got stuck.
Writing test for this peace of code:
Intent intent = new Intent(context, Some.class);
intent.setAction(Some.SYNC_SERVICE_ACTION_SYNC);
context.startService(intent);
And I would like to know how using mockito I can get intent action to test class for comparison if there was called the same intent?
In the test I'm trying to do something like this:
String action = "SyncService.SYNC_SERVICE_ACTION_SYNC";
when(context.startService(any())).thenReturn(Intent);
assertEquals("Do not match", action, Intent.getAction());
Maybe someone can help?