Search in sources :

Example 1 with EventSubscription

use of org.killbill.billing.client.model.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);
    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(), "START_ENTITLEMENT");
    Assert.assertEquals(events.get(1).getEffectiveDate(), new LocalDate(2012, 4, 25));
    Assert.assertEquals(events.get(1).getEventType(), "START_BILLING");
    Assert.assertEquals(events.get(2).getEffectiveDate(), new LocalDate(2012, 5, 25));
    Assert.assertEquals(events.get(2).getEventType(), "PHASE");
}
Also used : Account(org.killbill.billing.client.model.Account) EventSubscription(org.killbill.billing.client.model.EventSubscription) AccountTimeline(org.killbill.billing.client.model.AccountTimeline) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) Test(org.testng.annotations.Test)

Aggregations

DateTime (org.joda.time.DateTime)1 LocalDate (org.joda.time.LocalDate)1 Account (org.killbill.billing.client.model.Account)1 AccountTimeline (org.killbill.billing.client.model.AccountTimeline)1 EventSubscription (org.killbill.billing.client.model.EventSubscription)1 Test (org.testng.annotations.Test)1