Search in sources :

Example 1 with RequestGroupInfoJob

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

the class RecipientIdFollowUpJobMigrationTest method migrate_requestGroupInfoJob_good.

@Test
public void migrate_requestGroupInfoJob_good() throws Exception {
    JobData testData = new JobData("RequestGroupInfoJob", null, new Data.Builder().putString("source", "1").putString("group_id", "__textsecure_group__!abcdef0123456789abcdef0123456789").build());
    RecipientIdFollowUpJobMigration subject = new RecipientIdFollowUpJobMigration();
    JobData converted = subject.migrate(testData);
    assertEquals("RequestGroupInfoJob", converted.getFactoryKey());
    assertNull(converted.getQueueKey());
    assertEquals("1", converted.getData().getString("source"));
    assertEquals("__textsecure_group__!abcdef0123456789abcdef0123456789", converted.getData().getString("group_id"));
    new RequestGroupInfoJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Also used : JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) RequestGroupInfoJob(org.thoughtcrime.securesms.jobs.RequestGroupInfoJob) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with RequestGroupInfoJob

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

the class RecipientIdJobMigrationTest method migrate_requestGroupInfoJob.

@Test
public void migrate_requestGroupInfoJob() throws Exception {
    JobData testData = new JobData("RequestGroupInfoJob", null, new Data.Builder().putString("source", "+16101234567").putString("group_id", "__textsecure_group__!abcdef0123456789abcdef0123456789").build());
    mockRecipientResolve("+16101234567", 1);
    RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
    JobData converted = subject.migrate(testData);
    assertEquals("RequestGroupInfoJob", converted.getFactoryKey());
    assertNull(converted.getQueueKey());
    assertEquals("1", converted.getData().getString("source"));
    assertEquals("__textsecure_group__!abcdef0123456789abcdef0123456789", converted.getData().getString("group_id"));
    new RequestGroupInfoJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Also used : JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) RequestGroupInfoJob(org.thoughtcrime.securesms.jobs.RequestGroupInfoJob) 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 JobData (org.thoughtcrime.securesms.jobmanager.JobMigration.JobData)2 RequestGroupInfoJob (org.thoughtcrime.securesms.jobs.RequestGroupInfoJob)2 Application (android.app.Application)1