@Test(groups = "fast") public void testDeserializationWhenValueNotPresent() throws Exception { final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<adjustment type=\"credit\" href=\"https://api.recurly.com/v2/adjustments/626db120a84102b1809909071c701c60\">\n" + "<revenue_schedule_type></revenue_schedule_type>\n" + "</adjustment>"; Adjustment adjustment = xmlMapper.readValue(xml, Adjustment.class); assertEquals(adjustment.getRevenueScheduleType(), null); }
@Test(groups = "fast") public void testDeserializationWhenValueNotPresent() throws Exception { final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<adjustment type=\"credit\" href=\"https://api.recurly.com/v2/adjustments/626db120a84102b1809909071c701c60\">\n" + "<revenue_schedule_type></revenue_schedule_type>\n" + "</adjustment>"; Adjustment adjustment = xmlMapper.readValue(xml, Adjustment.class); assertEquals(adjustment.getRevenueScheduleType(), null); }
@Test(groups = "fast") public void testDeserializationWhenElementNotPresent() throws Exception { final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<adjustment type=\"credit\" href=\"https://api.recurly.com/v2/adjustments/626db120a84102b1809909071c701c60\">\n" + "</adjustment>"; Adjustment adjustment = xmlMapper.readValue(xml, Adjustment.class); assertEquals(adjustment.getRevenueScheduleType(), null); }
@Test(groups = "fast") public void testDeserializationWhenElementNotPresent() throws Exception { final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<adjustment type=\"credit\" href=\"https://api.recurly.com/v2/adjustments/626db120a84102b1809909071c701c60\">\n" + "</adjustment>"; Adjustment adjustment = xmlMapper.readValue(xml, Adjustment.class); assertEquals(adjustment.getRevenueScheduleType(), null); }
private void testDeserializationCommon(String value, RevenueScheduleType expectedRevenueScheduleType) throws Exception { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<adjustment type=\"credit\" href=\"https://api.recurly.com/v2/adjustments/626db120a84102b1809909071c701c60\">\n" + "<revenue_schedule_type>" + value + "</revenue_schedule_type>\n" + "</adjustment>"; Adjustment adjustment = xmlMapper.readValue(xml, Adjustment.class); assertEquals(adjustment.getRevenueScheduleType(), expectedRevenueScheduleType); } }
private void testDeserializationCommon(String value, RevenueScheduleType expectedRevenueScheduleType) throws Exception { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<adjustment type=\"credit\" href=\"https://api.recurly.com/v2/adjustments/626db120a84102b1809909071c701c60\">\n" + "<revenue_schedule_type>" + value + "</revenue_schedule_type>\n" + "</adjustment>"; Adjustment adjustment = xmlMapper.readValue(xml, Adjustment.class); assertEquals(adjustment.getRevenueScheduleType(), expectedRevenueScheduleType); } }
Assert.assertNull(adjustment.getEndDate()); Assert.assertEquals(adjustment.getCreatedAt(), new DateTime("2011-08-31T03:30:00Z")); Assert.assertEquals(adjustment.getRevenueScheduleType(), RevenueScheduleType.AT_INVOICE); Assert.assertEquals(readValue.getEndDate(), adjustment.getEndDate()); Assert.assertEquals(readValue.getCreatedAt(), adjustment.getCreatedAt()); Assert.assertEquals(readValue.getRevenueScheduleType(), adjustment.getRevenueScheduleType());
Assert.assertNull(adjustment.getEndDate()); Assert.assertEquals(adjustment.getCreatedAt(), new DateTime("2011-08-31T03:30:00Z")); Assert.assertEquals(adjustment.getRevenueScheduleType(), RevenueScheduleType.AT_INVOICE); Assert.assertEquals(readValue.getEndDate(), adjustment.getEndDate()); Assert.assertEquals(readValue.getCreatedAt(), adjustment.getCreatedAt()); Assert.assertEquals(readValue.getRevenueScheduleType(), adjustment.getRevenueScheduleType());