@Test public void shouldConsumeProcessingFunctionWhenRun() { @SuppressWarnings("unchecked") MessageQueue<String> queue = mock(MessageQueue.class); new TestWorker(queue).run(); verify(queue).consume(Matchers.any()); }
@Override public void run() { cancel = queue.consume(this::process); }
QueueWorker implements Runnable { @Override public void run() { cancel = queue.consume(this::process); } }
QueueWorker implements Runnable { @Override public void run() { cancel = queue.consume(this::process); } QueueWorker(MessageQueue<T> queue); }
QueueWorker implements Runnable { @Override public void run() { cancel = queue.consume(this::process); } QueueWorker(MessageQueue<T> queue); @Override void run(); void cancel(); }
QueueWorker implements Runnable { @Override public void run() { cancel = queue.consume(this::process); } QueueWorker(MessageQueue<T> queue); @Override void run(); void cancel();  }