use of org.joda.time.LocalDate in project killbill by killbill.
the class TestEffectiveDateForNewBCD method testPastEffectiveDateWithBCDEqualsComputedEffectiveDay.
@Test(groups = "fast")
public void testPastEffectiveDateWithBCDEqualsComputedEffectiveDay() throws Exception {
// Set by test as : 2012-05-07T00:03:42.000Z
final DateTime now = clock.getUTCNow();
int newBCD = 3;
// effectiveDate = 2012-05-07T00:03:42.000Z => ComputedEffectiveDay = 7
LocalDate effectiveDate = new LocalDate(2012, 2, 3);
// newBCD == ComputedEffectiveDay
final DateTime result = ((DefaultSubscriptionInternalApi) subscriptionInternalApi).getEffectiveDateForNewBCD(newBCD, effectiveDate, internalCallContext);
Assert.assertEquals(result, internalCallContext.toUTCDateTime(new LocalDate("2012-02-03")));
}
use of org.joda.time.LocalDate in project killbill by killbill.
the class TestEffectiveDateForNewBCD method testFutureEffectiveDateWithBCDEqualsComputedEffectiveDay.
@Test(groups = "fast")
public void testFutureEffectiveDateWithBCDEqualsComputedEffectiveDay() throws Exception {
// Set by test as : 2012-05-07T00:03:42.000Z
final DateTime now = clock.getUTCNow();
int newBCD = 3;
// effectiveDate = 2012-05-07T00:03:42.000Z => ComputedEffectiveDay = 7
LocalDate effectiveDate = new LocalDate(2012, 7, 3);
// newBCD == ComputedEffectiveDay
final DateTime result = ((DefaultSubscriptionInternalApi) subscriptionInternalApi).getEffectiveDateForNewBCD(newBCD, effectiveDate, internalCallContext);
Assert.assertEquals(result, internalCallContext.toUTCDateTime(new LocalDate("2012-07-03")));
}
use of org.joda.time.LocalDate in project killbill by killbill.
the class TestEffectiveDateForNewBCD method testFutureEffectiveDateWithBCDAfterEndOfTheMonth.
@Test(groups = "fast")
public void testFutureEffectiveDateWithBCDAfterEndOfTheMonth() throws Exception {
// Set by test as : 2012-05-07T00:03:42.000Z
final DateTime now = clock.getUTCNow();
int newBCD = 31;
// effectiveDate = 2012-06-03 => ComputedEffectiveDay = 3
LocalDate effectiveDate = new LocalDate(2012, 6, 3);
// newBCD > 30 (max day in June)
final DateTime result = ((DefaultSubscriptionInternalApi) subscriptionInternalApi).getEffectiveDateForNewBCD(newBCD, effectiveDate, internalCallContext);
Assert.assertEquals(result, internalCallContext.toUTCDateTime(new LocalDate("2012-06-30")));
}
use of org.joda.time.LocalDate in project killbill by killbill.
the class TestEffectiveDateForNewBCD method testPastEffectiveDateWithBCDPriorComputedEffectiveDay.
@Test(groups = "fast")
public void testPastEffectiveDateWithBCDPriorComputedEffectiveDay() throws Exception {
// Set by test as : 2012-05-07T00:03:42.000Z
final DateTime now = clock.getUTCNow();
int newBCD = 3;
// effectiveDate = 2012-05-07T00:03:42.000Z => ComputedEffectiveDay = 7
LocalDate effectiveDate = new LocalDate(2012, 2, 7);
// newBCD < ComputedEffectiveDay
final DateTime result = ((DefaultSubscriptionInternalApi) subscriptionInternalApi).getEffectiveDateForNewBCD(newBCD, effectiveDate, internalCallContext);
Assert.assertEquals(result, internalCallContext.toUTCDateTime(new LocalDate("2012-03-03")));
}
use of org.joda.time.LocalDate in project killbill by killbill.
the class TestEffectiveDateForNewBCD method testNullEffectiveDateWithBCDAfterEndOfTheMonth.
@Test(groups = "fast")
public void testNullEffectiveDateWithBCDAfterEndOfTheMonth() throws Exception {
// Set by test as : 2012-05-07T00:03:42.000Z
final DateTime now = clock.getUTCNow();
int newBCD = 10;
// effectiveDate = 2012-05-07T00:03:42.000Z => ComputedEffectiveDay = 7
LocalDate effectiveDate = null;
// newBCD < ComputedEffectiveDay
final DateTime result = ((DefaultSubscriptionInternalApi) subscriptionInternalApi).getEffectiveDateForNewBCD(newBCD, effectiveDate, internalCallContext);
Assert.assertEquals(result, internalCallContext.toUTCDateTime(new LocalDate("2012-05-10")));
}
Aggregations