// ----------------------------------------------------------------------- public void testWithDurationAdded_RP_int() { DateTime test = new DateTime(2002, 5, 3, 1, 2, 3, 4, BUDDHIST_DEFAULT); DateTime result = test.withPeriodAdded(new Period(1, 2, 3, 4, 5, 6, 7, 8), 1); DateTime expected = new DateTime(2003, 7, 28, 6, 8, 10, 12, BUDDHIST_DEFAULT); assertEquals(expected, result); result = test.withPeriodAdded(null, 1); assertSame(test, result); result = test.withPeriodAdded(new Period(1, 2, 3, 4, 5, 6, 7, 8), 0); assertSame(test, result); result = test.withPeriodAdded(new Period(1, 2, 0, 4, 5, 6, 7, 8), 3); expected = new DateTime(2005, 11, 15, 16, 20, 24, 28, BUDDHIST_DEFAULT); assertEquals(expected, result); result = test.withPeriodAdded(new Period(1, 2, 0, 1, 1, 2, 3, 4), -1); expected = new DateTime(2001, 3, 2, 0, 0, 0, 0, BUDDHIST_DEFAULT); assertEquals(expected, result); }