コード例 #1
0
 @Test
 public void testDeleteOfSingleMessage() {
   Mailbox mailbox = new Mailbox(data) {};
   assertEquals(1, data.size());
   mailbox.delete(2);
   assertEquals(0, data.size());
 }
コード例 #2
0
 @Test
 public void testReadOfSingleMessageFlipsReadFlag() {
   Mailbox mailbox = new Mailbox(data) {};
   MessageData message = mailbox.read(2);
   assertEquals(md, message);
   verifyMessage(message, true);
 }
コード例 #3
0
 @Test
 public void testReadingOfMessages() {
   Mailbox mailbox = new Mailbox(data) {};
   MessageData[] messages = mailbox.messages();
   assertEquals(1, messages.length);
   assertEquals(md, messages[0]);
   verifyMessage(messages[0], false);
 }
コード例 #4
0
 @Test
 public void testDeleteOfMissingMessageCausesException() {
   Mailbox mailbox = new Mailbox(data) {};
   try {
     mailbox.delete(22222);
   } catch (Exception e) {
     assertEquals("no such message ID", e.getMessage());
   }
 }
コード例 #5
0
 @Test
 public void testReadOfMissingMessageCausesException() {
   Mailbox mailbox = new Mailbox(data) {};
   try {
     MessageData message = mailbox.read(22222);
   } catch (Exception e) {
     assertEquals("no such message ID", e.getMessage());
   }
 }