1 36 package org.columba.ristretto.imap; 37 38 import junit.framework.TestCase; 39 40 public class SearchKeyTest extends TestCase { 41 42 public void testFlag() { 43 SearchKey sk = new SearchKey(SearchKey.FLAGGED); 44 assertEquals("FLAGGED", sk.toString()); 45 } 46 47 public void testString() { 48 SearchKey sk = new SearchKey(SearchKey.BODY,"Hello"); 49 assertEquals("BODY Hello", sk.toString()); 50 } 51 52 public void testInt() { 53 SearchKey sk = new SearchKey(SearchKey.SMALLER,new Integer (100)); 54 assertEquals("SMALLER 100", sk.toString()); 55 } 56 57 public void testOr() { 58 SearchKey sk = new SearchKey(SearchKey.OR,new SearchKey(SearchKey.SEEN), new SearchKey(SearchKey.DELETED)); 59 assertEquals("OR SEEN DELETED", sk.toString()); 60 } 61 62 public void testHeader() { 63 SearchKey sk = new SearchKey(SearchKey.HEADER, "X-Priority","3"); 64 assertEquals("HEADER X-Priority 3", sk.toString()); 65 } 66 67 public void testList() { 68 IMAPDateTime now = new IMAPDateTime(); 69 SearchKey sk = new SearchKey(SearchKey.BEFORE, now); 70 sk.add( new SearchKey(SearchKey.SEEN)); 71 sk.add( new SearchKey(SearchKey.DELETED)); 72 assertEquals("(BEFORE " + now.toString() + " SEEN DELETED)", sk.toString()); 73 } 74 } 75 | Popular Tags |