@Test(groups = "fast") public void testJson() throws Exception { final String refundId = UUID.randomUUID().toString(); final String paymentId = UUID.randomUUID().toString(); final BigDecimal amount = BigDecimal.TEN; final String currency = "USD"; final boolean isAdjusted = true; final DateTime requestedDate = clock.getUTCNow(); final DateTime effectiveDate = clock.getUTCNow(); final RefundStatus status = RefundStatus.COMPLETED; final List<InvoiceItemJson> adjustments = ImmutableList.<InvoiceItemJson>of(createInvoiceItemJson()); final List<AuditLogJson> auditLogs = createAuditLogsJson(clock.getUTCNow()); final RefundJson refundJson = new RefundJson(refundId, paymentId, amount, currency, status.toString(), isAdjusted, requestedDate, effectiveDate, adjustments, auditLogs); Assert.assertEquals(refundJson.getRefundId(), refundId); Assert.assertEquals(refundJson.getPaymentId(), paymentId); Assert.assertEquals(refundJson.getAmount(), amount); Assert.assertEquals(refundJson.getCurrency(), currency); Assert.assertEquals(refundJson.isAdjusted(), isAdjusted); Assert.assertEquals(refundJson.getRequestedDate(), requestedDate); Assert.assertEquals(refundJson.getEffectiveDate(), effectiveDate); Assert.assertEquals(refundJson.getAdjustments(), adjustments); Assert.assertEquals(refundJson.getAuditLogs(), auditLogs); final String asJson = mapper.writeValueAsString(refundJson); final RefundJson fromJson = mapper.readValue(asJson, RefundJson.class); Assert.assertEquals(fromJson, refundJson); }