@Test(groups = "fast") public void testSerialization() throws Exception { final BillingInfo billingInfo = new BillingInfo(); billingInfo.setAddress1(randomString()); billingInfo.setAddress2(randomString()); billingInfo.setCardType(randomString()); billingInfo.setCity(randomString()); billingInfo.setCompany(randomString()); billingInfo.setCountry(randomString()); billingInfo.setFirstName(randomString()); billingInfo.setFirstSix(randomString()); billingInfo.setIpAddress(randomString()); billingInfo.setIpAddressCountry(randomString()); billingInfo.setLastFour(randomString()); billingInfo.setLastName(randomString()); billingInfo.setMonth(3); billingInfo.setNumber(randomString()); billingInfo.setPhone(randomString()); billingInfo.setState(randomString()); billingInfo.setVatNumber(randomString()); billingInfo.setVerificationValue("009"); //CVV can have leading zeroes billingInfo.setYear(Integer.MIN_VALUE); billingInfo.setZip(randomString()); billingInfo.setGeoCode(randomString()); billingInfo.setGatewayToken(randomString()); billingInfo.setGatewayCode(randomString()); final String xml = xmlMapper.writeValueAsString(billingInfo); Assert.assertEquals(xmlMapper.readValue(xml, BillingInfo.class), billingInfo); }
@Test(groups = "fast") public void testSerialization() throws Exception { final BillingInfo billingInfo = new BillingInfo(); billingInfo.setAddress1(randomString()); billingInfo.setAddress2(randomString()); billingInfo.setCardType(randomString()); billingInfo.setCity(randomString()); billingInfo.setCompany(randomString()); billingInfo.setCountry(randomString()); billingInfo.setFirstName(randomString()); billingInfo.setFirstSix(randomString()); billingInfo.setIpAddress(randomString()); billingInfo.setIpAddressCountry(randomString()); billingInfo.setLastFour(randomString()); billingInfo.setLastName(randomString()); billingInfo.setMonth(3); billingInfo.setNumber(randomString()); billingInfo.setPhone(randomString()); billingInfo.setState(randomString()); billingInfo.setVatNumber(randomString()); billingInfo.setVerificationValue("009"); //CVV can have leading zeroes billingInfo.setYear(Integer.MIN_VALUE); billingInfo.setZip(randomString()); billingInfo.setGeoCode(randomString()); billingInfo.setGatewayToken(randomString()); billingInfo.setGatewayCode(randomString()); final String xml = xmlMapper.writeValueAsString(billingInfo); Assert.assertEquals(xmlMapper.readValue(xml, BillingInfo.class), billingInfo); }
/** * Creates a random {@link com.ning.billing.recurly.model.BillingInfo} object for testing use given a seed * * @param seed The RNG seed * @return The random {@link com.ning.billing.recurly.model.BillingInfo} object */ public static BillingInfo createRandomBillingInfo(final int seed) { final BillingInfo info = new BillingInfo(); info.setAccount(createRandomAccount(seed)); info.setFirstName(randomAlphaNumericString(5, seed)); info.setLastName(randomAlphaNumericString(6, seed)); info.setCompany(randomAlphaNumericString(10, seed)); info.setAddress1(randomAlphaNumericString(10, seed)); info.setAddress2(randomAlphaNumericString(10, seed)); info.setCity(randomAlphaNumericString(10, seed)); info.setState("CA"); info.setZip("94110"); info.setCountry("US"); info.setPhone(randomInteger(8, seed)); info.setVatNumber(randomNumericString(8, seed)); info.setYear(createTestCCYear()); info.setMonth(createTestCCMonth()); info.setNumber(createTestCCNumber()); info.setVerificationValue(createTestCCVerificationNumber()); return info; }
/** * Creates a random {@link com.ning.billing.recurly.model.BillingInfo} object for testing use given a seed * * @param seed The RNG seed * @return The random {@link com.ning.billing.recurly.model.BillingInfo} object */ public static BillingInfo createRandomBillingInfo(final int seed) { final BillingInfo info = new BillingInfo(); info.setAccount(createRandomAccount(seed)); info.setFirstName(randomAlphaNumericString(5, seed)); info.setLastName(randomAlphaNumericString(6, seed)); info.setCompany(randomAlphaNumericString(10, seed)); info.setAddress1(randomAlphaNumericString(10, seed)); info.setAddress2(randomAlphaNumericString(10, seed)); info.setCity(randomAlphaNumericString(10, seed)); info.setState("CA"); info.setZip("94110"); info.setCountry("US"); info.setPhone(randomInteger(8, seed)); info.setVatNumber(randomNumericString(8, seed)); info.setYear(createTestCCYear()); info.setMonth(createTestCCMonth()); info.setNumber(createTestCCNumber()); info.setVerificationValue(createTestCCVerificationNumber()); return info; }