Show
Ignore:
Timestamp:
08/19/08 08:34:29 PM (5 months ago)
Author:
octorian
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/LogicMailTests/src/org/logicprobe/LogicMail/mail/imap/ImapProtocolTest.java

    r271 r276  
    88 * 
    99 * 1. Redistributions of source code must retain the above copyright 
    10  *    notice, this list of conditions and the following disclaimer.  
     10 *    notice, this list of conditions and the following disclaimer. 
    1111 * 2. Redistributions in binary form must reproduce the above copyright 
    1212 *    notice, this list of conditions and the following disclaimer in the 
    13  *    documentation and/or other materials provided with the distribution.  
     13 *    documentation and/or other materials provided with the distribution. 
    1414 * 3. Neither the name of the project nor the names of its 
    1515 *    contributors may be used to endorse or promote products derived 
     
    2929 * OF THE POSSIBILITY OF SUCH DAMAGE. 
    3030 */ 
    31  
    3231package org.logicprobe.LogicMail.mail.imap; 
    3332 
     
    3635import j2meunit.framework.TestMethod; 
    3736import j2meunit.framework.TestSuite; 
    38 import java.io.IOException; 
     37 
     38import org.logicprobe.LogicMail.message.MessageEnvelope; 
     39import org.logicprobe.LogicMail.util.StringParser; 
     40 
    3941import java.util.Calendar; 
    4042import java.util.Hashtable; 
    4143import java.util.TimeZone; 
    4244import java.util.Vector; 
    43 import org.logicprobe.LogicMail.mail.MailException; 
    44 import org.logicprobe.LogicMail.message.MessageEnvelope; 
    45 import org.logicprobe.LogicMail.util.StringParser; 
     45 
    4646 
    4747/** 
     
    4949 */ 
    5050public class ImapProtocolTest extends TestCase { 
    51     /** 
    52      * Variation on ImapProtocol that overrides the "execute" method 
    53      * to facilitate testing 
    54      */ 
    55     class TestImapProtocol extends ImapProtocol { 
    56         private class ExecuteExpectation { 
    57             public String command; 
    58             public String arguments; 
    59             public String[] result; 
    60         } 
    61          
    62         private Vector executeExpectations; 
    63          
    64         public TestImapProtocol() { 
    65             super(null); 
    66             executeExpectations = new Vector(); 
    67         } 
    68          
    69         public void addExecuteExpectation(String command, String arguments, String[] result) { 
    70             ExecuteExpectation expect = new ExecuteExpectation(); 
    71             expect.command = command; 
    72             expect.arguments = arguments; 
    73             expect.result = result; 
    74             executeExpectations.addElement(expect); 
    75         } 
    76          
    77         public void clearExpectations() { 
    78             executeExpectations.removeAllElements(); 
    79         } 
    80          
    81         public void verifyExpectations() { 
    82             assertTrue("Expectations failed", executeExpectations.isEmpty()); 
    83         } 
    84          
    85         protected String[] execute(String command, String arguments) { 
    86             assertTrue("No expectations", !executeExpectations.isEmpty()); 
    87             ExecuteExpectation expect = (ExecuteExpectation)executeExpectations.lastElement(); 
    88             assertEquals("Bad command", expect.command, command); 
    89             assertEquals("Bad arguments", expect.arguments, arguments); 
    90             executeExpectations.removeElement(expect); 
    91             return expect.result; 
    92         } 
    93     } 
    94  
    9551    private TestImapProtocol instance; 
    96      
     52 
    9753    public ImapProtocolTest() { 
    9854    } 
    99      
     55 
    10056    public ImapProtocolTest(String testName, TestMethod testMethod) { 
    10157        super(testName, testMethod); 
    10258    } 
    103      
     59 
    10460    public void setUp() { 
    10561        instance = new TestImapProtocol(); 
    10662    } 
    107      
     63 
    10864    public void tearDown() { 
    10965        instance.verifyExpectations(); 
     
    11167        instance = null; 
    11268    } 
    113      
     69 
    11470    public void testExecuteCapability() { 
    11571        try { 
    116             instance.addExecuteExpectation( 
    117                     "CAPABILITY", null, 
    118                     new String[] { "* CAPABILITY ALPHA BRAVO CHARLIE DELTA" }); 
     72            instance.addExecuteExpectation("CAPABILITY", null, 
     73                new String[] { "* CAPABILITY ALPHA BRAVO CHARLIE DELTA" }); 
    11974 
    12075            Hashtable result = instance.executeCapability(); 
     
    12782            assertEquals(Boolean.TRUE, result.get("DELTA")); 
    12883        } catch (Throwable t) { 
    129             fail("Exception thrown during test: "+t.toString()); 
    130             t.printStackTrace(); 
    131         } 
    132     } 
    133      
    134     public void testExecuteNamespace() { 
     84            fail("Exception thrown during test: " + t.toString()); 
     85            t.printStackTrace(); 
     86        } 
     87    } 
     88 
     89    public void testExecuteNamespace1() { 
    13590        try { 
    13691            // Normal namespace: 
    13792            // NAMESPACE (("" "/")) (("Other Users/" "/")) NIL 
    138             instance.addExecuteExpectation( 
    139                     "NAMESPACE", null, 
    140                     new String[] { "* NAMESPACE ((\"\" \"/\")) ((\"Other Users/\" \"/\")) NIL" }); 
     93            instance.addExecuteExpectation("NAMESPACE", null, 
     94                new String[] { 
     95                    "* NAMESPACE ((\"\" \"/\")) ((\"Other Users/\" \"/\")) NIL" 
     96                }); 
     97 
    14198            ImapProtocol.NamespaceResponse result = instance.executeNamespace(); 
    142             assertNotNull(result); 
    143              
    144             assertNotNull(result.personal); 
     99            assertNotNull("Result", result); 
     100 
     101            assertNotNull("Personal", result.personal); 
    145102            assertEquals(1, result.personal.length); 
    146103            assertEquals("", result.personal[0].prefix); 
    147104            assertEquals("/", result.personal[0].delimiter); 
    148              
    149             assertNotNull(result.other); 
     105 
     106            assertNotNull("Other", result.other); 
    150107            assertEquals(1, result.other.length); 
    151108            assertEquals("Other Users/", result.other[0].prefix); 
    152109            assertEquals("/", result.other[0].delimiter); 
    153110 
    154             assertNull(result.shared); 
    155              
     111            assertNull("Shared", result.shared); 
     112        } catch (Throwable t) { 
     113            fail("Exception thrown during test: " + t.toString()); 
     114            t.printStackTrace(); 
     115        } 
     116    } 
     117 
     118    public void testExecuteNamespace2() { 
     119        try { 
    156120            // Escaped delimiters: 
    157121            // NAMESPACE (("" "\\")) (("Other Users\\" "\\")) (("Public Folders\\" "\\")) 
    158             instance.addExecuteExpectation( 
    159                     "NAMESPACE", null, 
    160                     new String[] { "* NAMESPACE ((\"\" \"\\\\\")) ((\"Other Users\\\\\" \"\\\\\")) ((\"Public Folders\\\\\" \"\\\\\"))" }); 
    161             result = instance.executeNamespace(); 
    162             assertNotNull(result); 
    163              
    164             assertNotNull(result.personal); 
     122            instance.addExecuteExpectation("NAMESPACE", null, 
     123                new String[] { 
     124                    "* NAMESPACE ((\"\" \"\\\\\")) ((\"Other Users\\\\\" \"\\\\\")) ((\"Public Folders\\\\\" \"\\\\\"))" 
     125                }); 
     126 
     127            ImapProtocol.NamespaceResponse result = instance.executeNamespace(); 
     128            assertNotNull("Result", result); 
     129 
     130            assertNotNull("Personal", result.personal); 
    165131            assertEquals(1, result.personal.length); 
    166132            assertEquals("", result.personal[0].prefix); 
    167133            assertEquals("\\", result.personal[0].delimiter); 
    168              
    169             assertNotNull(result.other); 
     134 
     135            assertNotNull("Other", result.other); 
    170136            assertEquals(1, result.other.length); 
    171137            assertEquals("Other Users\\", result.other[0].prefix); 
    172138            assertEquals("\\", result.other[0].delimiter); 
    173              
    174             assertNotNull(result.shared); 
     139 
     140            assertNotNull("Shared ", result.shared); 
    175141            assertEquals(1, result.shared.length); 
    176142            assertEquals("Public Folders\\", result.shared[0].prefix); 
    177143            assertEquals("\\", result.shared[0].delimiter); 
    178144        } catch (Throwable t) { 
    179             fail("Exception thrown during test: "+t.toString()); 
    180             t.printStackTrace(); 
    181         } 
    182     } 
    183      
     145            fail("Exception thrown during test: " + t.toString()); 
     146            t.printStackTrace(); 
     147        } 
     148    } 
     149 
    184150    public void testExecuteList1() { 
    185151        try { 
    186152            // Test top-level inbox 
    187             instance.addExecuteExpectation( 
    188                     "LIST", "\"\" \"%\"", 
    189                     new String[] { "* LIST (\\HasChildren) \".\" \"INBOX\"" }); 
     153            instance.addExecuteExpectation("LIST", "\"\" \"%\"", 
     154                new String[] { "* LIST (\\HasChildren) \".\" \"INBOX\"" }); 
     155 
    190156            Vector result = instance.executeList("", "%"); 
    191157            assertNotNull(result); 
    192158            assertEquals(1, result.size()); 
    193159            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    194             ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    195              
     160 
     161            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse) result.elementAt(0); 
     162 
    196163            assertTrue(result1.hasChildren); 
    197164            assertTrue(result1.canSelect); 
     
    200167            assertEquals("INBOX", result1.name); 
    201168        } catch (Throwable t) { 
    202             fail("Exception thrown during test: "+t.toString()); 
    203             t.printStackTrace(); 
    204         } 
    205     } 
    206      
     169            fail("Exception thrown during test: " + t.toString()); 
     170            t.printStackTrace(); 
     171        } 
     172    } 
     173 
    207174    public void testExecuteList2() { 
    208175        try { 
    209176            // Test subfolders of inbox 
    210             instance.addExecuteExpectation( 
    211                     "LIST", "\"INBOX.\" \"%\"", 
    212                     new String[] { 
    213                         "* LIST (\\HasNoChildren) \".\" \"INBOX.Saved\"", 
    214                         "* LIST (\\HasNoChildren) \".\" \"INBOX.Sent\"", 
    215                     }); 
    216          
     177            instance.addExecuteExpectation("LIST", "\"INBOX.\" \"%\"", 
     178                new String[] { 
     179                    "* LIST (\\HasNoChildren) \".\" \"INBOX.Saved\"", 
     180                    "* LIST (\\HasNoChildren) \".\" \"INBOX.Sent\"", 
     181                }); 
     182 
    217183            Vector result = instance.executeList("INBOX.", "%"); 
    218184            assertNotNull(result); 
     
    220186            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    221187            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    222             ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    223             ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
     188 
     189            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse) result.elementAt(0); 
     190            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse) result.elementAt(1); 
    224191 
    225192            assertTrue(!result1.hasChildren); 
     
    228195            assertEquals(".", result1.delim); 
    229196            assertEquals("INBOX.Saved", result1.name); 
    230          
     197 
    231198            assertTrue(!result2.hasChildren); 
    232199            assertTrue(result2.canSelect); 
     
    235202            assertEquals("INBOX.Sent", result2.name); 
    236203        } catch (Throwable t) { 
    237             fail("Exception thrown during test: "+t.toString()); 
    238             t.printStackTrace(); 
    239         } 
    240     } 
    241      
     204            fail("Exception thrown during test: " + t.toString()); 
     205            t.printStackTrace(); 
     206        } 
     207    } 
     208 
    242209    public void testExecuteList3() { 
    243210        try { 
    244211            // Test inbox with a NIL delimiter 
    245             instance.addExecuteExpectation( 
    246                     "LIST", "\"\" \"%\"", 
    247                     new String[] { 
    248                         "* LIST (\\HasNoChildren) NIL INBOX", 
    249                         "* LIST (\\HasNoChildren) \"/\" Sent" 
    250                     }); 
     212            instance.addExecuteExpectation("LIST", "\"\" \"%\"", 
     213                new String[] { 
     214                    "* LIST (\\HasNoChildren) NIL INBOX", 
     215                    "* LIST (\\HasNoChildren) \"/\" Sent" 
     216                }); 
     217 
    251218            Vector result = instance.executeList("", "%"); 
    252219            assertNotNull(result); 
     
    254221            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    255222            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    256             ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    257             ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
     223 
     224            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse) result.elementAt(0); 
     225            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse) result.elementAt(1); 
    258226 
    259227            assertTrue(!result1.hasChildren); 
     
    262230            assertEquals("", result1.delim); 
    263231            assertEquals("INBOX", result1.name); 
    264              
     232 
    265233            assertTrue(!result2.hasChildren); 
    266234            assertTrue(result2.canSelect); 
     
    269237            assertEquals("Sent", result2.name); 
    270238        } catch (Throwable t) { 
    271             fail("Exception thrown during test: "+t.toString()); 
    272             t.printStackTrace(); 
    273         } 
    274     } 
    275      
     239            fail("Exception thrown during test: " + t.toString()); 
     240            t.printStackTrace(); 
     241        } 
     242    } 
     243 
    276244    public void testExecuteList4() { 
    277245        try { 
    278246            // Test parameter in response 
    279             instance.addExecuteExpectation( 
    280                     "LIST", "\"INBOX.\" \"%\"", 
    281                     new String[] { 
    282                         "* LIST (\\HasChildren) \".\" \"INBOX\"", 
    283                         "* LIST (\\HasNoChildren) \".\" \"INBOX.Saved\"", 
    284                         "* LIST (\\HasNoChildren) \".\" \"INBOX.Sent\"", 
    285                     }); 
    286              
     247            instance.addExecuteExpectation("LIST", "\"INBOX.\" \"%\"", 
     248                new String[] { 
     249                    "* LIST (\\HasChildren) \".\" \"INBOX\"", 
     250                    "* LIST (\\HasNoChildren) \".\" \"INBOX.Saved\"", 
     251                    "* LIST (\\HasNoChildren) \".\" \"INBOX.Sent\"", 
     252                }); 
     253 
    287254            Vector result = instance.executeList("INBOX.", "%"); 
    288255            assertNotNull(result); 
     
    290257            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    291258            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    292             ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    293             ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
     259 
     260            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse) result.elementAt(0); 
     261            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse) result.elementAt(1); 
    294262 
    295263            assertTrue(!result1.hasChildren); 
     
    298266            assertEquals(".", result1.delim); 
    299267            assertEquals("INBOX.Saved", result1.name); 
    300          
     268 
    301269            assertTrue(!result2.hasChildren); 
    302270            assertTrue(result2.canSelect); 
     
    305273            assertEquals("INBOX.Sent", result2.name); 
    306274        } catch (Throwable t) { 
    307             fail("Exception thrown during test: "+t.toString()); 
    308             t.printStackTrace(); 
    309         } 
    310     } 
    311      
     275            fail("Exception thrown during test: " + t.toString()); 
     276            t.printStackTrace(); 
     277        } 
     278    } 
     279 
    312280    public void testExecuteList5() { 
    313281        try { 
    314282            // Test escaped delimiter 
    315             instance.addExecuteExpectation( 
    316                     "LIST", "\"INBOX\\\\\" \"%\"", 
    317                     new String[] { 
    318                         "* LIST (\\HasNoChildren) \"\\\\\" \"INBOX\\Saved\\Stuff\"", 
    319                         "* LIST (\\HasNoChildren) \"\\\\\" \"INBOX\\Sent\"", 
    320                     }); 
    321              
     283            instance.addExecuteExpectation("LIST", "\"INBOX\\\\\" \"%\"", 
     284                new String[] { 
     285                    "* LIST (\\HasNoChildren) \"\\\\\" \"INBOX\\Saved\\Stuff\"", 
     286                    "* LIST (\\HasNoChildren) \"\\\\\" \"INBOX\\Sent\"", 
     287                }); 
     288 
    322289            Vector result = instance.executeList("INBOX\\", "%"); 
    323290            assertNotNull(result); 
     
    325292            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    326293            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    327             ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    328             ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
     294 
     295            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse) result.elementAt(0); 
     296            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse) result.elementAt(1); 
    329297 
    330298            assertTrue(!result1.hasChildren); 
     
    333301            assertEquals("\\", result1.delim); 
    334302            assertEquals("INBOX\\Saved\\Stuff", result1.name); 
    335          
     303 
    336304            assertTrue(!result2.hasChildren); 
    337305            assertTrue(result2.canSelect); 
     
    340308            assertEquals("INBOX\\Sent", result2.name); 
    341309        } catch (Throwable t) { 
    342             fail("Exception thrown during test: "+t.toString()); 
    343             t.printStackTrace(); 
    344         } 
    345     } 
    346      
     310            fail("Exception thrown during test: " + t.toString()); 
     311            t.printStackTrace(); 
     312        } 
     313    } 
     314 
    347315    public void testExecuteList6() { 
    348316        try { 
    349317            // Test specified-length encoding for path name 
    350             instance.addExecuteExpectation( 
    351                     "LIST", "\"2007\\\\\" \"%\"", 
    352                     new String[] { 
    353                         "* LIST (\\HasNoChildren) \"\\\\\" {12}", 
    354                         "2007\\Q3-2007", 
    355                         "* LIST (\\HasNoChildren) \"\\\\\" {12}", 
    356                         "2007\\Q4-2007" 
    357                     }); 
     318            instance.addExecuteExpectation("LIST", "\"2007\\\\\" \"%\"", 
     319                new String[] { 
     320                    "* LIST (\\HasNoChildren) \"\\\\\" {12}", "2007\\Q3-2007", 
     321                    "* LIST (\\HasNoChildren) \"\\\\\" {12}", "2007\\Q4-2007" 
     322                }); 
    358323 
    359324            Vector result = instance.executeList("2007\\", "%"); 
     
    362327            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    363328            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    364             ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    365             ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
     329 
     330            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse) result.elementAt(0); 
     331            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse) result.elementAt(1); 
    366332 
    367333            assertTrue(!result1.hasChildren); 
     
    377343            assertEquals("2007\\Q4-2007", result2.name); 
    378344        } catch (Throwable t) { 
    379             fail("Exception thrown during test: "+t.toString()); 
    380             t.printStackTrace(); 
    381         } 
    382     } 
    383      
     345            fail("Exception thrown during test: " + t.toString()); 
     346            t.printStackTrace(); 
     347        } 
     348    } 
     349 
    384350    public void testExecuteFetchEnvelope1() { 
    385351        try { 
    386             instance.addExecuteExpectation( 
    387                 "FETCH", "1:1 (FLAGS UID ENVELOPE)", 
     352            instance.addExecuteExpectation("FETCH", "1:1 (FLAGS UID ENVELOPE)", 
    388353                new String[] { 
    389354                    "* 1 FETCH (FLAGS (\\Answered \\Seen) UID 10 " + 
     
    393358                    "((\"jim smith\" NIL \"jsmith\" \"scratch.test\")) " + 
    394359                    "((\"John Doe\" NIL \"jdoe\" \"generic.test\")) " + 
    395                     "NIL NIL " + 
    396                     "\"<200703121933.25327.jdoe@generic.test>\" " + 
     360                    "NIL NIL " + "\"<200703121933.25327.jdoe@generic.test>\" " + 
    397361                    "\"<7b02460f0703121938sff23a05xd3c2a37dc6b9eb7d@mail.scratch.test>\"))" 
    398362                }); 
    399             ImapProtocol.FetchEnvelopeResponse[] result = instance.executeFetchEnvelope(1, 1); 
     363 
     364            ImapProtocol.FetchEnvelopeResponse[] result = instance.executeFetchEnvelope(1, 
     365                    1); 
    400366            assertNotNull(result); 
    401367            assertEquals(1, result.length); 
    402368            assertNotNull(result[0]); 
    403              
     369 
    404370            assertEquals(1, result[0].index); 
    405371            assertEquals(10, result[0].uid); 
     
    411377            assertTrue(!result[0].flags.flagged); 
    412378            assertTrue(!result[0].flags.recent); 
    413              
     379 
    414380            assertNotNull(result[0].envelope); 
     381 
    415382            MessageEnvelope env = result[0].envelope; 
    416383            Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT-7")); 
     
    421388            cal.set(Calendar.MINUTE, 38); 
    422389            cal.set(Calendar.SECOND, 31); 
    423             assertEquals(StringParser.createDateString(cal.getTime()), StringParser.createDateString(env.date)); 
    424              
     390            assertEquals(StringParser.createDateString(cal.getTime()), 
     391                StringParser.createDateString(env.date)); 
     392 
    425393            assertEquals("Re: Calm down! :-)", env.subject); 
    426394 
     
    429397            assertNotNull(env.from[0]); 
    430398            assertEquals("jim smith <jsmith@scratch.test>", env.from[0]); 
    431              
     399 
    432400            assertNotNull(env.sender); 
    433401            assertEquals(1, env.sender.length); 
     
    439407            assertNotNull(env.replyTo[0]); 
    440408            assertEquals("jim smith <jsmith@scratch.test>", env.replyTo[0]); 
    441              
     409 
    442410            assertNotNull(env.to); 
    443411            assertEquals(1, env.to.length); 
    444412            assertNotNull(env.to[0]); 
    445413            assertEquals("John Doe <jdoe@generic.test>", env.to[0]); 
    446              
     414 
    447415            assertNull(env.cc); 
    448416            assertNull(env.bcc); 
    449              
     417 
    450418            assertEquals("<200703121933.25327.jdoe@generic.test>", env.inReplyTo); 
    451             assertEquals("<7b02460f0703121938sff23a05xd3c2a37dc6b9eb7d@mail.scratch.test>", env.messageId); 
    452              
    453         } catch (MailException e) { 
    454             fail("MailException thrown during test: "+e.toString()); 
    455             e.printStackTrace(); 
    456         } catch (IOException e) { 
    457             fail("IOException thrown during test: "+e.toString()); 
    458             e.printStackTrace(); 
    459         } 
    460     } 
    461      
     419            assertEquals("<7b02460f0703121938sff23a05xd3c2a37dc6b9eb7d@mail.scratch.test>", 
     420                env.messageId); 
     421        } catch (Throwable t) { 
     422            fail("Exception thrown during test: " + t.toString()); 
     423            t.printStackTrace(); 
     424        } 
     425    } 
     426 
    462427    public void testExecuteFetchEnvelope2() { 
    463428        try { 
    464             instance.addExecuteExpectation( 
    465                 "FETCH", "1:1 (FLAGS UID ENVELOPE)", 
     429            instance.addExecuteExpectation("FETCH", "1:1 (FLAGS UID ENVELOPE)", 
    466430                new String[] { 
    467431