void (boolean foodFirst) { final MyQueue queue = new MyQueue(); queue.showNotify(); final MyUpdate food = new MyUpdate("food"); MyUpdate hungry = new MyUpdate("hungry") { @Override public boolean canEat(@NotNull Update update) { return update == food; } }; if (foodFirst) { queue.queue(food); queue.queue(hungry); } else { queue.queue(hungry); queue.queue(food); } waitForExecution(queue); assertAfterProcessing(hungry, true, true); assertAfterProcessing(food, false, false); }