### Question:
MailAccountManager { public MailAccount reserveMailAccount() { return reserveMailAccount(DEFAULT_ACCOUNT_RESERVATION_KEY); } @Inject  MailAccountManager(final SetMultimap<String, MailAccount> emailAddressPools, final MathRandom random,
			final Provider<EventBus> eventBusProvider, final Configuration config); MailAccount reserveMailAccount(); MailAccount reserveMailAccount(final String accountReservationKey); MailAccount reserveMailAccount(final String accountReservationKey, final String pool); MailAccount lookupUsedMailAccountForCurrentThread(final String accountReservationKey); boolean isReserved(final MailAccount mailAccount); Set<MailAccount> getReservedMailAccountsForCurrentThread(); Set<String> getRegisteredAccountReservationKeysForCurrentThread(); void releaseAllMailAccounts(); void releaseAllMailAccountsForThread(); void releaseMailAccountForThread(final MailAccount account); void releaseMailAccountForThread(final String accountReservationKey); static final String DEFAULT_ACCOUNT_RESERVATION_KEY; }### Answer:
@Test public void mailboxShouldBePurgedOnReservation() { init(1); MailboxPurger purger = mock(MailboxPurger.class); eventBus.register(purger); try { MailAccount mailAccount = manager.reserveMailAccount(); verify(purger) .purgeMailbox( new MailAccountReservationEvent(MailAccountManager.DEFAULT_ACCOUNT_RESERVATION_KEY, mailAccount)); } finally { eventBus.unregister(purger); } }