use of com.ingenico.connect.gateway.sdk.java.domain.token.TokenResponse in project connect-sdk-java by Ingenico-ePayments.
the class DefaultMarshallerTest method testUnmarshalWithExtraFields.
@Test
public void testUnmarshalWithExtraFields() {
TokenResponseWithExtraField original = new TokenResponseWithExtraField();
Address billingAddress = new Address();
billingAddress.setCountryCode("NL");
CustomerToken customer = new CustomerToken();
customer.setBillingAddress(billingAddress);
TokenCardData data = new TokenCardData();
TokenCard card = new TokenCard();
card.setCustomer(customer);
card.setData(data);
original.setCard(card);
original.setExtraField("extra-field-value");
String json = DefaultMarshaller.INSTANCE.marshal(original);
TokenResponse unmarshalled = DefaultMarshaller.INSTANCE.unmarshal(json, TokenResponse.class);
Assert.assertNotNull(unmarshalled.getCard());
Assert.assertNotNull(unmarshalled.getCard().getCustomer());
Assert.assertNotNull(unmarshalled.getCard().getCustomer().getBillingAddress());
Assert.assertEquals("NL", unmarshalled.getCard().getCustomer().getBillingAddress().getCountryCode());
Assert.assertNotNull(unmarshalled.getCard().getData());
}
Aggregations