* @throws Exception If the test failes.
*/
public void testParse() throws Exception {
Calendar cal = Calendar.getInstance();
ISO8601DateFormat formatter = new ISO8601DateFormat();
// east
Date parsedDate = formatter.parse("1970-01-01+01:00");
cal.setTime(parsedDate);
cal.setTimeZone(TimeZone.getTimeZone("GMT+01"));
assertEquals(1970, cal.get(Calendar.YEAR));
assertEquals(Calendar.JANUARY, cal.get(Calendar.MONTH));
assertEquals(1, cal.get(Calendar.DAY_OF_MONTH));
// west
parsedDate = formatter.parse("1969-12-31-05:00");
cal.setTime(parsedDate);
cal.setTimeZone(TimeZone.getTimeZone("GMT-05"));
assertEquals(1969, cal.get(Calendar.YEAR));
assertEquals(Calendar.DECEMBER, cal.get(Calendar.MONTH));
assertEquals(31, cal.get(Calendar.DAY_OF_MONTH));
// GMT
parsedDate = formatter.parse("2003-03-18Z");
cal.setTime(parsedDate);
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
assertEquals(2003, cal.get(Calendar.YEAR));
assertEquals(Calendar.MARCH, cal.get(Calendar.MONTH));
assertEquals(18, cal.get(Calendar.DAY_OF_MONTH));
// no TZ
parsedDate = formatter.parse("1999-07-28");
cal.setTime(parsedDate);
cal.setTimeZone(TimeZone.getDefault());
assertEquals(1999, cal.get(Calendar.YEAR));
assertEquals(Calendar.JULY, cal.get(Calendar.MONTH));
assertEquals(28, cal.get(Calendar.DAY_OF_MONTH));