@Test public void test() throws DecodeException, IOException { final Invoice invoice = InvoiceSample.createInvoice(); final String json = JxEncoder._2.marshal(invoice); assertEquals(invoice, JxDecoder.VALIDATING.parseObject(Invoice.class, new JsonReader(new StringReader(json)))); }
public static Invoice createInvoice() { final Address address = new Address(); address.setName("John Doe"); address.setAddress("111 Wall St."); address.setCity("New York"); address.setPostalCode("10043"); address.setCountry("USA"); final Item item = new Item(); item.setCode(BigInteger.valueOf(123)); item.setDescription("Pocket Protector"); item.setPrice(new BigDecimal("14.99")); item.setQuantity(BigInteger.valueOf(5)); final Invoice invoice = new Invoice(); invoice.setNumber(BigInteger.valueOf(14738)); invoice.setDate("2019-05-13"); invoice.setBillingAddress(address); invoice.setShippingAddress(address); invoice.setBilledItems(Collections.singletonList(item)); return invoice; }
InvoiceSample { public static Invoice createInvoice() { final Address address = new Address(); address.setName("John Doe"); address.setAddress("111 Wall St."); address.setCity("New York"); address.setPostalCode("10043"); address.setCountry("USA"); final Item item = new Item(); item.setCode(BigInteger.valueOf(123)); item.setDescription("Pocket Protector"); item.setPrice(new BigDecimal("14.99")); item.setQuantity(BigInteger.valueOf(5)); final Invoice invoice = new Invoice(); invoice.setNumber(BigInteger.valueOf(14738)); invoice.setDate("2019-05-13"); invoice.setBillingAddress(address); invoice.setShippingAddress(address); invoice.setBilledItems(Collections.singletonList(item)); return invoice; } }
InvoiceSample { public static Invoice createInvoice() { final Address address = new Address(); address.setName("John Doe"); address.setAddress("111 Wall St."); address.setCity("New York"); address.setPostalCode("10043"); address.setCountry("USA"); final Item item = new Item(); item.setCode(BigInteger.valueOf(123)); item.setDescription("Pocket Protector"); item.setPrice(new BigDecimal("14.99")); item.setQuantity(BigInteger.valueOf(5)); final Invoice invoice = new Invoice(); invoice.setNumber(BigInteger.valueOf(14738)); invoice.setDate("2019-05-13"); invoice.setBillingAddress(address); invoice.setShippingAddress(address); invoice.setBilledItems(Collections.singletonList(item)); return invoice; }  }
InvoiceSample { public static Invoice createInvoice() { final Address address = new Address(); address.setName("John Doe"); address.setAddress("111 Wall St."); address.setCity("New York"); address.setPostalCode("10043"); address.setCountry("USA"); final Item item = new Item(); item.setCode(BigInteger.valueOf(123)); item.setDescription("Pocket Protector"); item.setPrice(new BigDecimal("14.99")); item.setQuantity(BigInteger.valueOf(5)); final Invoice invoice = new Invoice(); invoice.setNumber(BigInteger.valueOf(14738)); invoice.setDate("2019-05-13"); invoice.setBillingAddress(address); invoice.setShippingAddress(address); invoice.setBilledItems(Collections.singletonList(item)); return invoice; }  static void main(final String[] args); static Invoice createInvoice(); }
InvoiceSample { public static Invoice createInvoice() { final Address address = new Address(); address.setName("John Doe"); address.setAddress("111 Wall St."); address.setCity("New York"); address.setPostalCode("10043"); address.setCountry("USA"); final Item item = new Item(); item.setCode(BigInteger.valueOf(123)); item.setDescription("Pocket Protector"); item.setPrice(new BigDecimal("14.99")); item.setQuantity(BigInteger.valueOf(5)); final Invoice invoice = new Invoice(); invoice.setNumber(BigInteger.valueOf(14738)); invoice.setDate("2019-05-13"); invoice.setBillingAddress(address); invoice.setShippingAddress(address); invoice.setBilledItems(Collections.singletonList(item)); return invoice; }  static void main(final String[] args); static Invoice createInvoice();  }