1 36 package org.columba.ristretto.imap.parser; 37 38 import junit.framework.TestCase; 39 40 import org.columba.ristretto.imap.IMAPFlags; 41 import org.columba.ristretto.imap.IMAPResponse; 42 import org.columba.ristretto.message.Flags; 43 import org.columba.ristretto.parser.ParserException; 44 45 51 public class FlagsParserTest extends TestCase { 52 53 57 public FlagsParserTest(String arg0) { 58 super(arg0); 59 } 60 61 public void test1() { 62 try { 63 IMAPResponse response = IMAPResponseParser.parse("* 12 FETCH (FLAGS (\\Seen) UID 255)"); 64 IMAPFlags test = FlagsParser.parse(response); 65 66 assertTrue( test.get(Flags.SEEN) ); 67 assertTrue( ((Integer )test.getUid()).intValue() == 255); 68 } catch (ParserException e) { 69 e.printStackTrace(); 70 } 71 } 72 73 public void test2() { 74 try { 75 IMAPResponse response = IMAPResponseParser.parse("* 12 FETCH (UID 120 FLAGS (\\Recent))"); 76 IMAPFlags test = FlagsParser.parse(response); 77 78 assertTrue( test.get(Flags.RECENT) ); 79 assertTrue( ((Integer )test.getUid()).intValue() == 120); 80 } catch (ParserException e) { 81 e.printStackTrace(); 82 } 83 } 84 } 85 | Popular Tags |