1 36 package org.columba.ristretto.imap.parser; 37 38 import junit.framework.TestCase; 39 40 import org.columba.ristretto.imap.ResponseTextCode; 41 import org.columba.ristretto.parser.ParserException; 42 43 public class ResponseTextCodeParserTest extends TestCase { 44 45 public void testAlert() throws ParserException { 46 ResponseTextCode tc = ResponseTextCodeParser.parse("ALERT"); 47 48 assertEquals(tc.getType(), ResponseTextCode.ALERT); 49 } 50 51 public void testCapability() throws ParserException { 52 ResponseTextCode tc = ResponseTextCodeParser.parse("CAPABILITY IMAP4rev1 STARTTLS LOGINDISABLED"); 53 String [] results = new String [] { "IMAP4rev1", "STARTTLS", "LOGINDISABLED"}; 54 55 assertEquals(tc.getType(), ResponseTextCode.CAPABILITY); 56 for( int i=0; i<results.length; i++ ) { 57 assertEquals(tc.getStringArrayValue()[i], results[i]); 58 } 59 } 60 61 public void testUnseen() throws ParserException { 62 ResponseTextCode tc = ResponseTextCodeParser.parse("UNSEEN 12"); 63 64 assertEquals(tc.getType(), ResponseTextCode.UNSEEN); 65 assertEquals(tc.getIntValue(), 12); 66 } 67 68 } 69 | Popular Tags |