Search in sources :

Example 1 with WrongThreadException

use of com.birbit.android.jobqueue.WrongThreadException in project android-priority-jobqueue by yigit.

the class AssertThreadsTest method assertFailure.

private void assertFailure(final Runnable runnable) throws InterruptedException {
    final Throwable[] throwable = new Throwable[1];
    jobManager = createJobManager();
    final DummyJob dummyJob = new DummyJob(new Params(0)) {

        @Override
        public void onAdded() {
            super.onAdded();
            try {
                runnable.run();
            } catch (Throwable t) {
                throwable[0] = t;
            }
        }
    };
    waitUntilAJobIsDone(jobManager, new WaitUntilCallback() {

        @Override
        public void run() {
            jobManager.addJob(dummyJob);
        }

        @Override
        public void assertJob(Job job) {
        }
    });
    assertThat(throwable[0] instanceof WrongThreadException, is(true));
}
Also used : DummyJob(com.birbit.android.jobqueue.test.jobs.DummyJob) WrongThreadException(com.birbit.android.jobqueue.WrongThreadException) Params(com.birbit.android.jobqueue.Params) Job(com.birbit.android.jobqueue.Job) DummyJob(com.birbit.android.jobqueue.test.jobs.DummyJob)

Aggregations

Job (com.birbit.android.jobqueue.Job)1 Params (com.birbit.android.jobqueue.Params)1 WrongThreadException (com.birbit.android.jobqueue.WrongThreadException)1 DummyJob (com.birbit.android.jobqueue.test.jobs.DummyJob)1