Search in sources :

Example 1 with FailingJob

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

the class RecipientIdFollowUpJobMigrationTest method migrate_sendDeliveryReceiptJob_bad.

@Test
public void migrate_sendDeliveryReceiptJob_bad() throws Exception {
    JobData testData = new JobData("SendDeliveryReceiptJob", null, new Data.Builder().putString("recipient", "1").build());
    RecipientIdFollowUpJobMigration subject = new RecipientIdFollowUpJobMigration();
    JobData converted = subject.migrate(testData);
    assertEquals("FailingJob", converted.getFactoryKey());
    assertNull(converted.getQueueKey());
    new FailingJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Also used : FailingJob(org.thoughtcrime.securesms.jobs.FailingJob) 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 FailingJob

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

the class RecipientIdFollowUpJobMigrationTest method migrate_requestGroupInfoJob_bad.

@Test
public void migrate_requestGroupInfoJob_bad() throws Exception {
    JobData testData = new JobData("RequestGroupInfoJob", null, new Data.Builder().putString("source", "1").build());
    RecipientIdFollowUpJobMigration subject = new RecipientIdFollowUpJobMigration();
    JobData converted = subject.migrate(testData);
    assertEquals("FailingJob", converted.getFactoryKey());
    assertNull(converted.getQueueKey());
    new FailingJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Also used : FailingJob(org.thoughtcrime.securesms.jobs.FailingJob) 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)

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 FailingJob (org.thoughtcrime.securesms.jobs.FailingJob)2