use of org.thoughtcrime.securesms.database.JobDatabase in project Signal-Android by signalapp.
the class FastJobStorageTest method insertJobs_memoryOnlyJob_doesNotWriteToDatabase.
@Test
public void insertJobs_memoryOnlyJob_doesNotWriteToDatabase() {
JobDatabase database = noopDatabase();
FastJobStorage subject = new FastJobStorage(database);
subject.insertJobs(DataSetMemory.FULL_SPECS);
verify(database, times(0)).insertJobs(DataSet1.FULL_SPECS);
}
use of org.thoughtcrime.securesms.database.JobDatabase in project Signal-Android by signalapp.
the class FastJobStorageTest method fixedDataDatabase.
private JobDatabase fixedDataDatabase(List<FullSpec> fullSpecs) {
JobDatabase database = mock(JobDatabase.class);
when(database.getAllJobSpecs()).thenReturn(Stream.of(fullSpecs).map(FullSpec::getJobSpec).toList());
when(database.getAllConstraintSpecs()).thenReturn(Stream.of(fullSpecs).map(FullSpec::getConstraintSpecs).flatMap(Stream::of).toList());
when(database.getAllDependencySpecs()).thenReturn(Stream.of(fullSpecs).map(FullSpec::getDependencySpecs).flatMap(Stream::of).toList());
return database;
}
use of org.thoughtcrime.securesms.database.JobDatabase in project Signal-Android by signalapp.
the class FastJobStorageTest method deleteJobs_memoryOnly_doesNotWriteToDatabase.
@Test
public void deleteJobs_memoryOnly_doesNotWriteToDatabase() {
JobDatabase database = fixedDataDatabase(DataSetMemory.FULL_SPECS);
FastJobStorage subject = new FastJobStorage(database);
List<String> ids = Collections.singletonList("id1");
subject.init();
subject.deleteJobs(ids);
verify(database, times(0)).deleteJobs(ids);
}
use of org.thoughtcrime.securesms.database.JobDatabase in project Signal-Android by signalapp.
the class FastJobStorageTest method noopDatabase.
private JobDatabase noopDatabase() {
JobDatabase database = mock(JobDatabase.class);
when(database.getAllJobSpecs()).thenReturn(Collections.emptyList());
when(database.getAllConstraintSpecs()).thenReturn(Collections.emptyList());
when(database.getAllDependencySpecs()).thenReturn(Collections.emptyList());
return database;
}
use of org.thoughtcrime.securesms.database.JobDatabase in project Signal-Android by signalapp.
the class FastJobStorageTest method deleteJobs_writesToDatabase.
@Test
public void deleteJobs_writesToDatabase() {
JobDatabase database = fixedDataDatabase(DataSet1.FULL_SPECS);
FastJobStorage subject = new FastJobStorage(database);
List<String> ids = Arrays.asList("id1", "id2");
subject.init();
subject.deleteJobs(ids);
verify(database).deleteJobs(ids);
}
Aggregations