Search in sources :

Example 1 with PushGroupUpdateJob

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

the class RecipientIdJobMigrationTest method migrate_pushGroupUpdateJob.

@Test
public void migrate_pushGroupUpdateJob() throws Exception {
    JobData testData = new JobData("PushGroupUpdateJob", 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("PushGroupUpdateJob", converted.getFactoryKey());
    assertNull(converted.getQueueKey());
    assertEquals("1", converted.getData().getString("source"));
    assertEquals("__textsecure_group__!abcdef0123456789abcdef0123456789", converted.getData().getString("group_id"));
    new PushGroupUpdateJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Also used : JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) Application(android.app.Application) PushGroupUpdateJob(org.thoughtcrime.securesms.jobs.PushGroupUpdateJob) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with PushGroupUpdateJob

use of org.thoughtcrime.securesms.jobs.PushGroupUpdateJob in project Signal-Android by signalapp.

the class RecipientIdJobMigrationTest method migrate_pushGroupUpdateJob.

@Test
public void migrate_pushGroupUpdateJob() throws Exception {
    JobData testData = new JobData("PushGroupUpdateJob", 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("PushGroupUpdateJob", converted.getFactoryKey());
    assertNull(converted.getQueueKey());
    assertEquals("1", converted.getData().getString("source"));
    assertEquals("__textsecure_group__!abcdef0123456789abcdef0123456789", converted.getData().getString("group_id"));
    new PushGroupUpdateJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Also used : JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) Application(android.app.Application) PushGroupUpdateJob(org.thoughtcrime.securesms.jobs.PushGroupUpdateJob) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

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