Пример #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());
   }
 }