@Test(groups = "fast") public void testJson() throws Exception { final String someUUID = UUID.randomUUID().toString(); final UUID bundleId = UUID.randomUUID(); final String externalKey = UUID.randomUUID().toString(); final List<AuditLogJson> auditLogs = createAuditLogsJson(clock.getUTCNow()); EventSubscriptionJson event = new EventSubscriptionJson(someUUID, BillingPeriod.NO_BILLING_PERIOD.toString(), new LocalDate(), new LocalDate(), "product", "priceList", "eventType", "phase", null); final SubscriptionJson subscription = new SubscriptionJson(someUUID, someUUID, someUUID, externalKey, new LocalDate(), someUUID, someUUID, someUUID, someUUID, new LocalDate(), new LocalDate(), new LocalDate(), new LocalDate(), ImmutableList.<EventSubscriptionJson>of(event), null, null, auditLogs); final BundleJson bundleJson = new BundleJson(someUUID, bundleId.toString(), externalKey, ImmutableList.<SubscriptionJson>of(subscription), auditLogs); Assert.assertEquals(bundleJson.getBundleId(), bundleId.toString()); Assert.assertEquals(bundleJson.getExternalKey(), externalKey); Assert.assertEquals(bundleJson.getSubscriptions().size(), 1); Assert.assertEquals(bundleJson.getAuditLogs(), auditLogs); final String asJson = mapper.writeValueAsString(bundleJson); final BundleJson fromJson = mapper.readValue(asJson, BundleJson.class); Assert.assertEquals(fromJson, bundleJson); } }