// ----------------------------------------------------------------------- public void testToPeriod_PeriodType1() { DateTime dt1 = new DateTime(2004, 6, 9, 7, 8, 9, 10, COPTIC_PARIS); DateTime dt2 = new DateTime(2005, 8, 13, 12, 14, 16, 18, COPTIC_PARIS); MutableInterval base = new MutableInterval(dt1, dt2); Period test = base.toPeriod(null); Period expected = new Period(dt1, dt2, PeriodType.standard()); assertEquals(expected, test); }
public void testConstructor_RP_RI3() throws Throwable { DateTime dt = new DateTime(TEST_TIME_NOW, CopticChronology.getInstanceUTC()); Period dur = new Period(0, 6, 0, 3, 1, 0, 0, 0, PeriodType.standard()); long result = TEST_TIME_NOW; result = CopticChronology.getInstanceUTC().months().add(result, -6); result = CopticChronology.getInstanceUTC().days().add(result, -3); result = CopticChronology.getInstanceUTC().hours().add(result, -1); Interval test = new Interval(dur, dt); assertEquals(result, test.getStartMillis()); assertEquals(dt.getMillis(), test.getEndMillis()); }