Search in sources :

Example 36 with Params

use of com.path.android.jobqueue.Params in project android-priority-jobqueue by path.

the class JobParamsTest method assertParamsUnderstood.

@Test
public void assertParamsUnderstood() {
    DummyJob j1 = new DummyJob(new Params(1).requireNetwork());
    assertThat("require network param should be understood properly", j1.requiresNetwork(), equalTo(true));
    DummyJob j2 = new DummyJob(new Params(1).groupBy("blah"));
    assertThat("group param should be understood properly", j2.getRunGroupId(), equalTo("blah"));
    DummyJob j3 = new DummyJob(new Params(1).persist());
    assertThat("group param should be understood properly", j3.isPersistent(), equalTo(true));
    DummyJob j4 = new DummyJob(new Params(1).setPersistent(false).setRequiresNetwork(false).setGroupId(null));
    assertThat("persist param should be understood properly", j4.isPersistent(), equalTo(false));
    assertThat("require network param should be understood properly", j4.requiresNetwork(), equalTo(false));
    assertThat("group param should be understood properly", j4.getRunGroupId(), nullValue());
}
Also used : DummyJob(com.path.android.jobqueue.test.jobs.DummyJob) Params(com.path.android.jobqueue.Params) Test(org.junit.Test)

Aggregations

Params (com.path.android.jobqueue.Params)36 Test (org.junit.Test)33 DummyJob (com.path.android.jobqueue.test.jobs.DummyJob)22 JobManager (com.path.android.jobqueue.JobManager)20 JobHolder (com.path.android.jobqueue.JobHolder)17 JobQueue (com.path.android.jobqueue.JobQueue)13 CountDownLatch (java.util.concurrent.CountDownLatch)8 Configuration (com.path.android.jobqueue.config.Configuration)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 BaseJob (com.path.android.jobqueue.BaseJob)4 Job (com.path.android.jobqueue.Job)3 ArrayList (java.util.ArrayList)3 DependencyInjector (com.path.android.jobqueue.di.DependencyInjector)2 CustomLogger (com.path.android.jobqueue.log.CustomLogger)2 Semaphore (java.util.concurrent.Semaphore)2 AsyncAddCallback (com.path.android.jobqueue.AsyncAddCallback)1 JobStatus (com.path.android.jobqueue.JobStatus)1 JobConsumerExecutor (com.path.android.jobqueue.executor.JobConsumerExecutor)1 SqliteJobQueue (com.path.android.jobqueue.persistentQueue.sqlite.SqliteJobQueue)1 LinkedList (java.util.LinkedList)1