}
}
public void testDuration() throws Exception {
Calendar now = Calendar.getInstance();
TimeDuration zeroDuration = TimeDuration.ZeroTimeDuration;
assertFalse("zero equals null", zeroDuration.equals(null));
Calendar newTime = (Calendar) now.clone();
zeroDuration.addToCalendar(newTime);
assertEquals("zero same calendar", now, newTime);
assertDurationFields("zero(same zero calendar)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0", new TimeDuration(zero, zero), false, true);
assertDurationFields("zero(same now calendar)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0", new TimeDuration(now, now), false, true);
assertDurationFields("zero(empty parse)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0", TimeDuration.parseDuration(""), false, true);
assertDurationFields("zero(zero parse)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0", TimeDuration.parseDuration("0:0:0:0:0:0:0"), false, true);
assertDurationFields("zero(from null number)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0", TimeDuration.fromNumber(null), false, true);
assertDurationFields("zero(from null number)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0", TimeDuration.fromNumber(null), false, true);
assertDuration("millisecond", 0, 0, 0, 0, 0, 0, 1);
assertDuration("second", 0, 0 ,0 ,0, 0, 1, 0);
assertDuration("minute", 0, 0, 0, 0, 1, 0, 0);
assertDuration("hour", 0, 0, 0, 1, 0, 0, 0);
assertDuration("day", 0, 0, 1, 0, 0, 0, 0);
assertDuration("month", 0, 1, 0, 0, 0, 0, 0);
assertDuration("year", 1, 0, 0, 0, 0, 0, 0);
Calendar start = new com.ibm.icu.util.GregorianCalendar(1967, 1, 1, 0, 0, 0);
start.set(Calendar.MILLISECOND, 0);
Calendar end = (Calendar) start.clone();
end.add(Calendar.MILLISECOND, 1);
end.add(Calendar.SECOND, 1);
end.add(Calendar.MINUTE, 1);
end.add(Calendar.HOUR_OF_DAY, 1);
end.add(Calendar.DAY_OF_MONTH, 1);
end.add(Calendar.MONTH, 1);
end.add(Calendar.YEAR, 1);
assertDurationFields("pre-epoch elapsed time", 1, 1, 1, 1, 1, 1, 1, "1:1:1:1:1:1:1", new TimeDuration(start, end), false, false);
}