@Test public void testDeleteOfSingleMessage() { Mailbox mailbox = new Mailbox(data) {}; assertEquals(1, data.size()); mailbox.delete(2); assertEquals(0, data.size()); }
@Test public void testDeleteOfMissingMessageCausesException() { Mailbox mailbox = new Mailbox(data) {}; try { mailbox.delete(22222); } catch (Exception e) { assertEquals("no such message ID", e.getMessage()); } }