Search in sources :

Example 1 with SendDeliveryReceiptJob

use of org.thoughtcrime.securesms.jobs.SendDeliveryReceiptJob in project Signal-Android by WhisperSystems.

the class RecipientIdFollowUpJobMigrationTest method migrate_sendDeliveryReceiptJob_good.

@Test
public void migrate_sendDeliveryReceiptJob_good() throws Exception {
    JobData testData = new JobData("SendDeliveryReceiptJob", null, new Data.Builder().putString("recipient", "1").putLong("message_id", 1).putLong("timestamp", 2).build());
    RecipientIdFollowUpJobMigration subject = new RecipientIdFollowUpJobMigration();
    JobData converted = subject.migrate(testData);
    assertEquals("SendDeliveryReceiptJob", converted.getFactoryKey());
    assertNull(converted.getQueueKey());
    assertEquals("1", converted.getData().getString("recipient"));
    assertEquals(1, converted.getData().getLong("message_id"));
    assertEquals(2, converted.getData().getLong("timestamp"));
    new SendDeliveryReceiptJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Also used : SendDeliveryReceiptJob(org.thoughtcrime.securesms.jobs.SendDeliveryReceiptJob) JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) Data(org.thoughtcrime.securesms.jobmanager.Data) JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with SendDeliveryReceiptJob

use of org.thoughtcrime.securesms.jobs.SendDeliveryReceiptJob in project Signal-Android by WhisperSystems.

the class RecipientIdJobMigrationTest method migrate_sendDeliveryReceiptJob.

@Test
public void migrate_sendDeliveryReceiptJob() throws Exception {
    JobData testData = new JobData("SendDeliveryReceiptJob", null, new Data.Builder().putString("address", "+16101234567").putLong("message_id", 1).putLong("timestamp", 2).build());
    mockRecipientResolve("+16101234567", 1);
    RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
    JobData converted = subject.migrate(testData);
    assertEquals("SendDeliveryReceiptJob", converted.getFactoryKey());
    assertNull(converted.getQueueKey());
    assertEquals("1", converted.getData().getString("recipient"));
    assertEquals(1, converted.getData().getLong("message_id"));
    assertEquals(2, converted.getData().getLong("timestamp"));
    new SendDeliveryReceiptJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Also used : SendDeliveryReceiptJob(org.thoughtcrime.securesms.jobs.SendDeliveryReceiptJob) JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) Data(org.thoughtcrime.securesms.jobmanager.Data) JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) Application(android.app.Application) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 Data (org.thoughtcrime.securesms.jobmanager.Data)2 JobData (org.thoughtcrime.securesms.jobmanager.JobMigration.JobData)2 SendDeliveryReceiptJob (org.thoughtcrime.securesms.jobs.SendDeliveryReceiptJob)2 Application (android.app.Application)1