}
public static void testGregorianCalendar()
{
// this is a check of DST offsets
Date date = new GDate("2002-04-18T23:59:59Z").getDate();
GregorianCalendar gcal = new XmlCalendar(date);
Assert.assertEquals(date, gcal.getTime());
// now check out some things
GDate gd = new GDate("2001-12-31T07:00:59.010");
GregorianCalendar gc = gd.getCalendar();
Date gdd = gd.getDate();
Date gcd = gc.getTime();
Assert.assertEquals(gdd, gcd);
// set up 2/29, and read out Feb 29 in the year 1 BC.
Calendar gregcal = new GDate("--02-29").getCalendar();
Assert.assertEquals(29, gregcal.get(Calendar.DAY_OF_MONTH));
Assert.assertEquals(2 - 1, gregcal.get(Calendar.MONTH));
Assert.assertEquals(1, gregcal.get(Calendar.YEAR));
Assert.assertEquals(0, gregcal.get(Calendar.ERA));
// repeat some tests to make sure it's stable.
Assert.assertEquals(29, gregcal.get(Calendar.DAY_OF_MONTH));
Assert.assertEquals(2 - 1, gregcal.get(Calendar.MONTH));
// now try some setters
gregcal = new GDate("--02-29").getCalendar();
gregcal.set(Calendar.MONTH, 10);
Assert.assertEquals("--11-29", gregcal.toString());
// repeat to ensure it's stable.
Assert.assertEquals("--11-29", gregcal.toString());
}