use of com.zegoggles.smssync.service.state.BackupState in project sms-backup-plus by jberkel.
the class BackupTaskTest method shouldBackupItems.
@Test
public void shouldBackupItems() throws Exception {
mockFetch(SMS, 1);
when(converter.convertMessages(any(Cursor.class), eq(SMS))).thenReturn(result(SMS, 1));
when(store.getFolder(notNull(DataType.class), same(dataTypePreferences))).thenReturn(folder);
BackupState finalState = task.doInBackground(config);
verify(folder).appendMessages(anyListOf(Message.class));
verify(service).transition(SmsSyncState.LOGIN, null);
verify(service).transition(SmsSyncState.CALC, null);
assertThat(finalState).isNotNull();
assertThat(finalState.isFinished()).isTrue();
assertThat(finalState.currentSyncedItems).isEqualTo(1);
assertThat(finalState.itemsToSync).isEqualTo(1);
assertThat(finalState.backupType).isEqualTo(config.backupType);
}
Aggregations