1 36 package org.columba.ristretto.imap; 37 38 import java.util.Calendar ; 39 import java.util.TimeZone ; 40 41 import junit.framework.TestCase; 42 43 public class IMAPDateTest extends TestCase { 44 45 public void test1() { 46 TimeZone tz = TimeZone.getTimeZone("Europe/Berlin"); 47 Calendar calendar = Calendar.getInstance(tz); 48 calendar.set(2004,2,8,18,32,30); 49 50 IMAPDateTime date = new IMAPDateTime( calendar.getTime(), tz ); 51 assertEquals("\"08-Mar-2004 18:32:30 +0100\"", date.toString()); 52 53 } 54 55 public void test2() { 56 TimeZone tz = TimeZone.getTimeZone("Europe/London"); 57 Calendar calendar = Calendar.getInstance(tz); 58 calendar.set(2004,2,16,8,2,3); 59 60 IMAPDateTime date = new IMAPDateTime( calendar.getTime(), tz ); 61 assertEquals("\"16-Mar-2004 08:02:03 +0000\"", date.toString()); 62 63 } 64 65 public void test3() { 66 TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles"); 67 Calendar calendar = Calendar.getInstance(tz); 68 calendar.set(2004,2,16,8,12,3); 69 70 IMAPDateTime date = new IMAPDateTime( calendar.getTime(), tz ); 71 assertEquals("\"16-Mar-2004 08:12:03 -0800\"", date.toString()); 72 73 } 74 } 75 | Popular Tags |