use of org.thoughtcrime.securesms.jobs.SendReadReceiptJob in project Signal-Android by signalapp.
the class SendReadReceiptsJobMigrationTest method givenSendReadReceiptJobDataWithoutThreadIdAndThreadIdFound_whenIMigrate_thenIInsertThreadId.
@Test
public void givenSendReadReceiptJobDataWithoutThreadIdAndThreadIdFound_whenIMigrate_thenIInsertThreadId() {
// GIVEN
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>(), new ArrayList<>());
JobMigration.JobData jobData = new JobMigration.JobData(job.getFactoryKey(), "asdf", new Data.Builder().putString("recipient", RecipientId.from(2).serialize()).putLongArray("message_ids", new long[] { 1, 2, 3, 4, 5 }).putLong("timestamp", 292837649).build());
when(mockDatabase.getThreadForMessageId(anyLong())).thenReturn(1234L);
// WHEN
JobMigration.JobData result = testSubject.migrate(jobData);
// THEN
assertEquals(1234L, result.getData().getLong("thread"));
assertEquals(RecipientId.from(2).serialize(), result.getData().getString("recipient"));
assertTrue(result.getData().hasLongArray("message_ids"));
assertTrue(result.getData().hasLong("timestamp"));
}
Aggregations