@Test public void shouldConvert() throws Exception { RequestMap expectedMap = new RequestMap(); expectedMap.putMap(new HashMap<String, String>() {{ put("shippingAddressCountry", "BRA"); put("shippingAddressState", "PA"); put("shippingAddressCity", "city"); put("shippingAddressPostalCode", "99999999"); put("shippingAddressDistrict", "district"); put("shippingAddressStreet", "street"); put("shippingAddressNumber", "999"); put("shippingAddressComplement", "complement"); put("shippingType", "2"); put("shippingCost", "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("shippingType", shippingType.getTypeId()); } requestMap.putCurrency("shippingCost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); }
ShippingV2MapConverter extends AbstractMapConverter<Shipping> { protected void convert(RequestMap requestMap, Shipping shipping) { final ShippingType shippingType = shipping.getShippingType(); if (shippingType != null) { requestMap.putInteger("shippingType", shippingType.getTypeId()); } requestMap.putCurrency("shippingCost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); } }
ShippingV2MapConverter extends AbstractMapConverter<Shipping> { protected void convert(RequestMap requestMap, Shipping shipping) { final ShippingType shippingType = shipping.getShippingType(); if (shippingType != null) { requestMap.putInteger("shippingType", shippingType.getTypeId()); } requestMap.putCurrency("shippingCost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); }  }
ShippingV2MapConverter extends AbstractMapConverter<Shipping> { protected void convert(RequestMap requestMap, Shipping shipping) { final ShippingType shippingType = shipping.getShippingType(); if (shippingType != null) { requestMap.putInteger("shippingType", shippingType.getTypeId()); } requestMap.putCurrency("shippingCost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); }   }
ShippingV2MapConverter extends AbstractMapConverter<Shipping> { protected void convert(RequestMap requestMap, Shipping shipping) { final ShippingType shippingType = shipping.getShippingType(); if (shippingType != null) { requestMap.putInteger("shippingType", shippingType.getTypeId()); } requestMap.putCurrency("shippingCost", shipping.getCost()); requestMap.putMap(SHIPPING_ADDRESS_MAP_CONVERTER.convert(shipping.getAddress())); }    }