@Test(groups = "fast")
public void testFromInvoice() throws Exception {
final Invoice invoice = Mockito.mock(Invoice.class);
Mockito.when(invoice.getChargedAmount()).thenReturn(BigDecimal.TEN);
Mockito.when(invoice.getCreditedAmount()).thenReturn(BigDecimal.ONE);
Mockito.when(invoice.getRefundedAmount()).thenReturn(BigDecimal.ONE);
Mockito.when(invoice.getId()).thenReturn(UUID.randomUUID());
Mockito.when(invoice.getInvoiceDate()).thenReturn(clock.getUTCToday());
Mockito.when(invoice.getTargetDate()).thenReturn(clock.getUTCToday());
Mockito.when(invoice.getInvoiceNumber()).thenReturn(Integer.MAX_VALUE);
Mockito.when(invoice.getBalance()).thenReturn(BigDecimal.ZERO);
Mockito.when(invoice.getAccountId()).thenReturn(UUID.randomUUID());
Mockito.when(invoice.getCurrency()).thenReturn(Currency.MXN);
final String bundleKeys = UUID.randomUUID().toString();
final List<CreditJson> credits = ImmutableList.<CreditJson>of(createCreditJson());
final InvoiceJson invoiceJson = new InvoiceJson(invoice, bundleKeys, credits, null);
Assert.assertEquals(invoiceJson.getAmount(), invoice.getChargedAmount());
Assert.assertEquals(invoiceJson.getCreditAdj(), invoice.getCreditedAmount());
Assert.assertEquals(invoiceJson.getRefundAdj(), invoice.getRefundedAmount());
Assert.assertEquals(invoiceJson.getInvoiceId(), invoice.getId().toString());
Assert.assertEquals(invoiceJson.getInvoiceDate(), invoice.getInvoiceDate());
Assert.assertEquals(invoiceJson.getTargetDate(), invoice.getTargetDate());
Assert.assertEquals(invoiceJson.getInvoiceNumber(), String.valueOf(invoice.getInvoiceNumber()));
Assert.assertEquals(invoiceJson.getBalance(), invoice.getBalance());
Assert.assertEquals(invoiceJson.getAccountId(), invoice.getAccountId().toString());
Assert.assertEquals(invoiceJson.getBundleKeys(), bundleKeys);
Assert.assertEquals(invoiceJson.getCredits(), credits);
Assert.assertNull(invoiceJson.getAuditLogs());
}