@Test
public void shouldCleanAsyncTask() {

    AsyncTaskWithDialog mockAsyncTaskWithDialog = mock(AsyncTaskWithDialog.class);
    SynchronisationAsyncTask mockSyncTask = mock(SynchronisationAsyncTask.class);
    NotificationManager mockNotification = mock(NotificationManager.class);
    application.setAsyncTaskWithDialog(mockAsyncTaskWithDialog);
    application.setSyncTask(mockSyncTask);
    doReturn(mockNotification).when(application).getSystemService(Context.NOTIFICATION_SERVICE);
    assertTrue(application.cleanSyncTask());
    verify(mockAsyncTaskWithDialog).cancel();
    verify(mockSyncTask).cancel(false);
    verify(mockNotification).cancel(SynchronisationAsyncTask.NOTIFICATION_ID);
}