@Test public void shouldConvert() throws Exception { RequestMap expectedMap = new RequestMap(); expectedMap.putMap(new HashMap<String, String>() {{ put("shipping.address.country", "BRA"); put("shipping.address.state", "PA"); put("shipping.address.city", "city"); put("shipping.address.postalCode", "99999999"); put("shipping.address.district", "district"); put("shipping.address.street", "street"); put("shipping.address.number", "999"); put("shipping.address.complement", "complement"); put("shipping.type", "2"); put("shipping.cost", "99.99"); }}); RequestMap map = mapConverter.convert(shipping); assertEquals(expectedMap, map); }
protected void convert(RequestMap requestMap, Shipping shipping) { final ShippingType shippingType = shipping.getShippingType(); if (shippingType != null) { requestMap.putInteger("shipping.type", shippingType.getTypeId()); } requestMap.putCurrency("shipping.cost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); }
ShippingV3MapConverter extends AbstractMapConverter<Shipping> { protected void convert(RequestMap requestMap, Shipping shipping) { final ShippingType shippingType = shipping.getShippingType(); if (shippingType != null) { requestMap.putInteger("shipping.type", shippingType.getTypeId()); } requestMap.putCurrency("shipping.cost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); } }
ShippingV3MapConverter extends AbstractMapConverter<Shipping> { protected void convert(RequestMap requestMap, Shipping shipping) { final ShippingType shippingType = shipping.getShippingType(); if (shippingType != null) { requestMap.putInteger("shipping.type", shippingType.getTypeId()); } requestMap.putCurrency("shipping.cost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); }  }
ShippingV3MapConverter extends AbstractMapConverter<Shipping> { protected void convert(RequestMap requestMap, Shipping shipping) { final ShippingType shippingType = shipping.getShippingType(); if (shippingType != null) { requestMap.putInteger("shipping.type", shippingType.getTypeId()); } requestMap.putCurrency("shipping.cost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); }   }
ShippingV3MapConverter extends AbstractMapConverter<Shipping> { protected void convert(RequestMap requestMap, Shipping shipping) { final ShippingType shippingType = shipping.getShippingType(); if (shippingType != null) { requestMap.putInteger("shipping.type", shippingType.getTypeId()); } requestMap.putCurrency("shipping.cost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); }    }