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));
}
Aggregations