use of org.killbill.billing.client.model.gen.EventSubscription in project killbill by killbill.
the class TestAccountTimeline method testAccountTimeline.
@Test(groups = "slow", description = "Can retrieve the timeline without audits")
public void testAccountTimeline() throws Exception {
clock.setTime(new DateTime(2012, 4, 25, 0, 3, 42, 0));
final Account accountJson = createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice();
final AccountTimeline timeline = getAccountTimeline(accountJson.getAccountId(), AuditLevel.NONE);
Assert.assertEquals(timeline.getPayments().size(), 1);
Assert.assertEquals(timeline.getInvoices().size(), 2);
Assert.assertEquals(timeline.getBundles().size(), 1);
Assert.assertEquals(timeline.getBundles().get(0).getSubscriptions().size(), 1);
Assert.assertEquals(timeline.getBundles().get(0).getSubscriptions().get(0).getEvents().size(), 3);
Assert.assertNotNull(timeline.getInvoices().get(0).getBundleKeys());
final List<EventSubscription> events = timeline.getBundles().get(0).getSubscriptions().get(0).getEvents();
Assert.assertEquals(events.get(0).getEffectiveDate(), new LocalDate(2012, 4, 25));
Assert.assertEquals(events.get(0).getEventType(), SubscriptionEventType.START_ENTITLEMENT);
Assert.assertEquals(events.get(1).getEffectiveDate(), new LocalDate(2012, 4, 25));
Assert.assertEquals(events.get(1).getEventType(), SubscriptionEventType.START_BILLING);
Assert.assertEquals(events.get(2).getEffectiveDate(), new LocalDate(2012, 5, 25));
Assert.assertEquals(events.get(2).getEventType(), SubscriptionEventType.PHASE);
}
Aggregations