### Question:
MailboxProcessor { public void allActionsCompleted() { sendPriorityLetter(mailboxPoisonLetter); } MailboxProcessor(MailboxDefaultAction mailboxDefaultAction); MailboxExecutorService getMailboxExecutor(); void open(); void prepareClose(); void close(); void runMailboxLoop(); void reportThrowable(Throwable throwable); void allActionsCompleted();  }### Answer:
@Test public void testRunDefaultAction() throws Exception { final int expectedInvocations = 3; final AtomicInteger counter = new AtomicInteger(0); MailboxThread mailboxThread = new MailboxThread() { @Override public void runDefaultAction(DefaultActionContext context) { if (counter.incrementAndGet() == expectedInvocations) { context.allActionsCompleted(); } } }; start(mailboxThread); stop(mailboxThread); Assert.assertEquals(expectedInvocations, counter.get()); }