use of com.birbit.android.jobqueue.messaging.message.CommandMessage in project android-priority-jobqueue by yigit.
the class UnsafeMessageQueueTest method simplePostAtFront.
@Test
public void simplePostAtFront() {
Message m = new CommandMessage();
Message m2 = new CommandMessage();
Message m3 = new CommandMessage();
mq.postAtFront(m);
mq.postAtFront(m2);
mq.postAtFront(m3);
assertThat(mq.next(), is(m3));
assertThat(mq.next(), is(m2));
assertThat(mq.next(), is(m));
}
use of com.birbit.android.jobqueue.messaging.message.CommandMessage in project android-priority-jobqueue by yigit.
the class UnsafeMessageQueueTest method add.
private Message add(long id) {
CommandMessage msg = new CommandMessage();
mq.post(msg);
added.put(id, msg);
return msg;
}
use of com.birbit.android.jobqueue.messaging.message.CommandMessage in project android-priority-jobqueue by yigit.
the class DelayedMessageBagAddTest method add.
private Message add(long readyNs) {
CommandMessage msg = factory.obtain(CommandMessage.class);
bag.add(msg, readyNs);
added.put(readyNs, msg);
return msg;
}
use of com.birbit.android.jobqueue.messaging.message.CommandMessage in project android-priority-jobqueue by yigit.
the class MessageFactoryTest method test.
@Test
public void test() {
AddJobMessage aj1 = factory.obtain(AddJobMessage.class);
assertThat(aj1, isA(AddJobMessage.class));
CommandMessage cm1 = factory.obtain(CommandMessage.class);
assertThat(cm1, isA(CommandMessage.class));
assertThat(factory.obtain(AddJobMessage.class), not(sameInstance(aj1)));
assertThat(factory.obtain(CommandMessage.class), not(sameInstance(cm1)));
factory.release(aj1);
factory.release(cm1);
assertThat(factory.obtain(AddJobMessage.class), sameInstance(aj1));
assertThat(factory.obtain(CommandMessage.class), sameInstance(cm1));
assertThat(factory.obtain(AddJobMessage.class), not(sameInstance(aj1)));
assertThat(factory.obtain(CommandMessage.class), not(sameInstance(cm1)));
}
Aggregations