Search in sources :

Example 1 with DefaultChangedField

use of org.killbill.billing.account.api.DefaultChangedField in project killbill by killbill.

the class TestEventJson method testDefaultAccountChangeEvent.

@Test(groups = "fast", description = "Test Account event deserialization")
public void testDefaultAccountChangeEvent() throws Exception {
    final List<ChangedField> changes = new ArrayList<ChangedField>();
    changes.add(new DefaultChangedField("fieldXX", "valueX", "valueXXX", clock.getUTCNow()));
    changes.add(new DefaultChangedField("fieldYY", "valueY", "valueYYY", clock.getUTCNow()));
    final AccountChangeInternalEvent e = new DefaultAccountChangeEvent(changes, UUID.randomUUID(), 1L, 2L, null);
    final String json = mapper.writeValueAsString(e);
    final Class<?> claz = Class.forName("org.killbill.billing.account.api.user.DefaultAccountChangeEvent");
    final Object obj = mapper.readValue(json, claz);
    Assert.assertTrue(obj.equals(e));
}
Also used : AccountChangeInternalEvent(org.killbill.billing.events.AccountChangeInternalEvent) DefaultChangedField(org.killbill.billing.account.api.DefaultChangedField) ChangedField(org.killbill.billing.events.ChangedField) ArrayList(java.util.ArrayList) DefaultChangedField(org.killbill.billing.account.api.DefaultChangedField) Test(org.testng.annotations.Test)

Aggregations

ArrayList (java.util.ArrayList)1 DefaultChangedField (org.killbill.billing.account.api.DefaultChangedField)1 AccountChangeInternalEvent (org.killbill.billing.events.AccountChangeInternalEvent)1 ChangedField (org.killbill.billing.events.ChangedField)1 Test (org.testng.annotations.Test)1