@Test(groups = "fast") public void testItemShouldNotStartInThePast() throws Exception { final LocalDate startDate = new LocalDate(2012, 7, 16); final LocalDate endDate = new LocalDate(2012, 7, 16); final LocalDate targetDate = new LocalDate(2012, 7, 16); final int billingCycleDayLocal = 15; final LinkedHashMap<LocalDate, LocalDate> expectedDates = new LinkedHashMap<LocalDate, LocalDate>(); verifyInvoiceItems(startDate, endDate, targetDate, TIMEZONE, billingCycleDayLocal, BILLING_PERIOD, expectedDates); }
@Test(groups = "fast") public void testCalculateSimpleInvoiceItemWithBCDEqualsStartDay() throws Exception { final LocalDate startDate = new LocalDate(2012, 7, 16); final LocalDate endDate = new LocalDate(2012, 8, 16); final LocalDate targetDate = new LocalDate(2012, 7, 16); final int billingCycleDayLocal = 16; final LinkedHashMap<LocalDate, LocalDate> expectedDates = new LinkedHashMap<LocalDate, LocalDate>(); expectedDates.put(new LocalDate(2012, 7, 16), new LocalDate(2012, 8, 16)); verifyInvoiceItems(startDate, endDate, targetDate, TIMEZONE, billingCycleDayLocal, BILLING_PERIOD, expectedDates); }
@Test(groups = "fast") public void testCalculateSimpleInvoiceItemWithNoEndDate() throws Exception { final LocalDate startDate = new LocalDate(new DateTime("2012-07-17T02:25:33.000Z", DateTimeZone.UTC), TIMEZONE); final LocalDate endDate = null; final LocalDate targetDate = new LocalDate(2012, 7, 16); final int billingCycleDayLocal = 15; final LinkedHashMap<LocalDate, LocalDate> expectedDates = new LinkedHashMap<LocalDate, LocalDate>(); expectedDates.put(new LocalDate(2012, 7, 16), new LocalDate(2012, 8, 15)); verifyInvoiceItems(startDate, endDate, targetDate, TIMEZONE, billingCycleDayLocal, BILLING_PERIOD, expectedDates); }
@Test(groups = "fast") public void testCalculateSimpleInvoiceItemWithBCDAfterStartDay() throws Exception { final LocalDate startDate = new LocalDate(2012, 7, 16); final LocalDate endDate = new LocalDate(2012, 8, 16); final LocalDate targetDate = new LocalDate(2012, 7, 16); final int billingCycleDayLocal = 17; final LinkedHashMap<LocalDate, LocalDate> expectedDates = new LinkedHashMap<LocalDate, LocalDate>(); expectedDates.put(new LocalDate(2012, 7, 16), new LocalDate(2012, 7, 17)); verifyInvoiceItems(startDate, endDate, targetDate, TIMEZONE, billingCycleDayLocal, BILLING_PERIOD, expectedDates); }
@Test(groups = "fast") public void testCalculateSimpleInvoiceItemWithBCDBeforeStartDay() throws Exception { final LocalDate startDate = new LocalDate(2012, 7, 16); final LocalDate endDate = new LocalDate(2012, 8, 16); final LocalDate targetDate = new LocalDate(2012, 7, 16); final int billingCycleDayLocal = 15; final LinkedHashMap<LocalDate, LocalDate> expectedDates = new LinkedHashMap<LocalDate, LocalDate>(); expectedDates.put(new LocalDate(2012, 7, 16), new LocalDate(2012, 8, 15)); verifyInvoiceItems(startDate, endDate, targetDate, TIMEZONE, billingCycleDayLocal, BILLING_PERIOD, expectedDates); }
@Test(groups = "fast") public void testCalculateSimpleInvoiceItemWithBCDBeforeStartDayWithTargetDateIn3Months() throws Exception { final LocalDate startDate = new LocalDate(2012, 7, 16); final LocalDate endDate = null; final LocalDate targetDate = new LocalDate(2012, 10, 16); final int billingCycleDayLocal = 15; final LinkedHashMap<LocalDate, LocalDate> expectedDates = new LinkedHashMap<LocalDate, LocalDate>(); expectedDates.put(new LocalDate(2012, 7, 16), new LocalDate(2012, 8, 15)); expectedDates.put(new LocalDate(2012, 8, 15), new LocalDate(2012, 9, 15)); expectedDates.put(new LocalDate(2012, 9, 15), new LocalDate(2012, 10, 15)); expectedDates.put(new LocalDate(2012, 10, 15), new LocalDate(2012, 11, 15)); verifyInvoiceItems(startDate, endDate, targetDate, TIMEZONE, billingCycleDayLocal, BILLING_PERIOD, expectedDates); }
@Test(groups = "fast") public void testCalculateSimpleInvoiceItemWithBCDAfterStartDayWithTargetDateIn3Months() throws Exception { final LocalDate startDate = new LocalDate(2012, 7, 16); final LocalDate endDate = null; final LocalDate targetDate = new LocalDate(2012, 10, 16); final int billingCycleDayLocal = 17; final LinkedHashMap<LocalDate, LocalDate> expectedDates = new LinkedHashMap<LocalDate, LocalDate>(); expectedDates.put(new LocalDate(2012, 7, 16), new LocalDate(2012, 7, 17)); expectedDates.put(new LocalDate(2012, 7, 17), new LocalDate(2012, 8, 17)); expectedDates.put(new LocalDate(2012, 8, 17), new LocalDate(2012, 9, 17)); expectedDates.put(new LocalDate(2012, 9, 17), new LocalDate(2012, 10, 17)); verifyInvoiceItems(startDate, endDate, targetDate, TIMEZONE, billingCycleDayLocal, BILLING_PERIOD, expectedDates); }
@Test(groups = "fast") public void testCalculateSimpleInvoiceItemWithBCDEqualsStartDayWithTargetDateIn3Months() throws Exception { final LocalDate startDate = new LocalDate(2012, 7, 16); final LocalDate endDate = null; final LocalDate targetDate = new LocalDate(2012, 10, 16); final int billingCycleDayLocal = 16; final LinkedHashMap<LocalDate, LocalDate> expectedDates = new LinkedHashMap<LocalDate, LocalDate>(); expectedDates.put(new LocalDate(2012, 7, 16), new LocalDate(2012, 8, 16)); expectedDates.put(new LocalDate(2012, 8, 16), new LocalDate(2012, 9, 16)); expectedDates.put(new LocalDate(2012, 9, 16), new LocalDate(2012, 10, 16)); expectedDates.put(new LocalDate(2012, 10, 16), new LocalDate(2012, 11, 16)); verifyInvoiceItems(startDate, endDate, targetDate, TIMEZONE, billingCycleDayLocal, BILLING_PERIOD, expectedDates); }