}
}
}
public void testDurationConstructor() throws Exception {
final DateValue DV = new DateValueImpl(2005, 2, 15);
final DateTimeValue DTV0 = new DateTimeValueImpl(2005, 2, 15, 0, 0, 0),
DTV12 = new DateTimeValueImpl(2005, 2, 15, 12, 0, 0);
DateValue ONE_DAY = new DateValueImpl(0, 0, 1),
YESTERDAY = new DateValueImpl(0, 0, -1),
ONE_WEEK = new DateValueImpl(0, 0, 7),
ONE_MONTH = new DateValueImpl(0, 1, 0),
ONE_YEAR = new DateValueImpl(1, 0, 0);
DateTimeValue ONE_HOUR = new DateTimeValueImpl(0, 0, 0, 1, 0, 0),
TWELVE_HOURS = new DateTimeValueImpl(0, 0, 0, 12, 0, 0),
SAME_TIME = new DateTimeValueImpl(0, 0, 0, 0, 0, 0);
assertEquals(PeriodValueImpl.create(DV, new DateValueImpl(2005, 2, 16)),
PeriodValueImpl.createFromDuration(DV, ONE_DAY));
assertEquals(PeriodValueImpl.create(DV, new DateValueImpl(2005, 2, 22)),
PeriodValueImpl.createFromDuration(DV, ONE_WEEK));
assertEquals(PeriodValueImpl.create(DV, new DateValueImpl(2005, 3, 15)),
PeriodValueImpl.createFromDuration(DV, ONE_MONTH));
assertEquals(PeriodValueImpl.create(DV, new DateValueImpl(2006, 2, 15)),
PeriodValueImpl.createFromDuration(DV, ONE_YEAR));
try {
PeriodValueImpl.createFromDuration(DV, YESTERDAY);
fail("I believe our adventures in time have taken a most serious turn.");
} catch (IllegalArgumentException ex) {