public BackupConfig retryWithStore(BackupImapStore store) { return new BackupConfig(store, currentTry + 1, maxItemsPerSync, groupToBackup, backupType, typesToBackup, debug); }
@Test(expected = IllegalArgumentException.class) public void shouldCheckForDataTypesEmpty() throws Exception { new BackupConfig(mock(BackupImapStore.class), 0, -1, ContactGroup.EVERYBODY, BackupType.MANUAL, EnumSet.noneOf(DataType.class), false); }
@Test(expected = IllegalArgumentException.class) public void shouldCheckForPositiveTry() throws Exception { new BackupConfig(mock(BackupImapStore.class), -1, -1, ContactGroup.EVERYBODY, BackupType.MANUAL, EnumSet.of(DataType.MMS), false); } }
@SuppressWarnings("ConstantConditions") @Test(expected = IllegalArgumentException.class) public void shouldCheckForDataTypesNull() throws Exception { new BackupConfig(mock(BackupImapStore.class), 0, -1, ContactGroup.EVERYBODY, BackupType.MANUAL, null, false); }
private BackupConfig getBackupConfig(EnumSet<DataType> types) { return new BackupConfig(store, 0, 100, new ContactGroup(-1), BackupType.MANUAL, types, false ); }
private BackupConfig getBackupConfig(BackupType backupType, EnumSet<DataType> enabledTypes, BackupImapStore imapStore) { return new BackupConfig( imapStore, 0, getPreferences().getMaxItemsPerSync(), getPreferences().getBackupContactGroup(), backupType, enabledTypes, getPreferences().isAppLogDebug() ); }
@Test public void shouldSkipItems() throws Exception { when(fetcher.getMostRecentTimestamp(any(DataType.class))).thenReturn(-23L); BackupState finalState = task.doInBackground(new BackupConfig( store, 0, 100, new ContactGroup(-1), BackupType.SKIP, EnumSet.of(SMS), false ) ); verify(dataTypePreferences).setMaxSyncedDate(DataType.SMS, -23); verifyZeroInteractions(dataTypePreferences); assertThat(finalState).isNotNull(); assertThat(finalState.isFinished()).isTrue(); }