Mailbox { public void post(Mail mail) { if (mail == null) { throw new NullPointerException("Mail to post must not be null."); } enforcer.enforce(this); Class<?> toClass = mail.to; MailHandler handler = getCacheCurrentAtHomeHandler(toClass); if (handler != null) { dispatch(mail, handler); } else { enqueue(mail); } } Mailbox();  Mailbox(String identifier);  Mailbox(ThreadEnforcer enforcer);  Mailbox(ThreadEnforcer enforcer, String identifier);   Mailbox(ThreadEnforcer enforcer, String identifier, HandlerFinder handlerFinder); static Mailbox getInstance(); void atHome(Object object); void leave(Object object); void post(Mail mail); @Override String toString(); static final String DEFAULT_IDENTIFIER; }
@Test public void testPostMail() { mailbox.post(new Mail(CONTENT, this.getClass())); }