assertEquals("00:00:00.123Z", JodaConvert.serializeUTCLocalTime(new LocalTime(0, 0, 0, 123)));
}
public void testDeserializeZonedDateTime() throws JiBXException {
assertNull("Null input", JodaConvert.deserializeZonedDateTime(null));
DateTime time = JodaConvert.deserializeZonedDateTime("2008-02-28T01:02:03");
DateTimeZone zone = time.getZone();
assertEquals("Default timezone expected", OFFSET_MILLIS, zone.getOffset(time));
assertEquals("Wrong value", 2008, time.getYear());
assertEquals("Wrong value", 2, time.getMonthOfYear());
assertEquals("Wrong value", 28, time.getDayOfMonth());
assertEquals("Wrong value", 1, time.getHourOfDay());
assertEquals("Wrong value", 2, time.getMinuteOfHour());
assertEquals("Wrong value", 3, time.getSecondOfMinute());
time = JodaConvert.deserializeUTCDateTime("2008-02-28T01:02:03Z");
zone = time.getZone();
assertEquals("UTC timezone expected", "UTC", zone.getID());
assertEquals("Wrong value", 2008, time.getYear());
assertEquals("Wrong value", 2, time.getMonthOfYear());
assertEquals("Wrong value", 28, time.getDayOfMonth());
assertEquals("Wrong value", 1, time.getHourOfDay());
assertEquals("Wrong value", 2, time.getMinuteOfHour());
assertEquals("Wrong value", 3, time.getSecondOfMinute());
time = JodaConvert.deserializeUTCDateTime("2008-02-29T24:00:00Z");
zone = time.getZone();
assertEquals("UTC timezone expected", "UTC", zone.getID());
assertEquals("Wrong value", 2008, time.getYear());
assertEquals("Wrong value", 3, time.getMonthOfYear());
assertEquals("Wrong value", 1, time.getDayOfMonth());
assertEquals("Wrong value", 0, time.getHourOfDay());
assertEquals("Wrong value", 0, time.getMinuteOfHour());
assertEquals("Wrong value", 0, time.getSecondOfMinute());
time = JodaConvert.deserializeZonedDateTime("2008-02-29T02:05:06.123-02:30");
zone = time.getZone();
assertEquals("Expected -02:30 timezone", -150*60*1000, zone.getOffset(time));
assertEquals("Wrong value", 2008, time.getYear());
assertEquals("Wrong value", 2, time.getMonthOfYear());
assertEquals("Wrong value", 29, time.getDayOfMonth());
assertEquals("Wrong value", 2, time.getHourOfDay());
assertEquals("Wrong value", 5, time.getMinuteOfHour());
assertEquals("Wrong value", 6, time.getSecondOfMinute());
assertEquals("Wrong value", 123, time.getMillisOfSecond());
try {
JodaConvert.deserializeZonedDateTime("2007-02-29T02:05:06.123-02:00");
fail("Invalid day number");
} catch (JiBXException ex) {}
try {