}
public MailQueueItem deQueue() throws MailQueueException {
if (throwException) {
throwException = false;
throw new MailQueueException("Mock");
}
try {
final Mail mail = queue.take();
return new MailQueueItem() {
public Mail getMail() {
return mail;
}
public void done(boolean success) throws MailQueueException {
// do nothing here
}
};
} catch (InterruptedException e) {
throw new MailQueueException("Mock",e);
}
}