@Test public void shouldConvert() throws Exception { RequestMap expectedMap = new RequestMap(); expectedMap.putMap(new HashMap<String, String>() {{ put("senderEmail", "email@email.com"); put("senderName", "name"); put("senderAreaCode", "16"); put("senderPhone", "123456789"); put("senderAddressCountry", "BRA"); put("senderAddressState", "PA"); put("senderAddressCity", "city"); put("senderAddressPostalCode", "99999999"); put("senderAddressDistrict", "district"); put("senderAddressStreet", "street"); put("senderAddressNumber", "999"); put("senderAddressComplement", "complement"); put("senderCPF", "99999999999"); put("senderHash", "hash"); }}); RequestMap map = mapConverter.convert(sender); assertEquals(expectedMap, map); }
@Override protected void convert(RequestMap requestMap, Sender sender) { requestMap.putString("senderEmail", sender.getEmail()); requestMap.putString("senderName", sender.getName()); requestMap.putString("senderCPF", sender.getCpf()); requestMap.putString("senderCNPJ", sender.getCnpj()); requestMap.putString("senderHash", sender.getHash()); requestMap.putMap(SENDER_PHONE_MC.convert(sender.getPhone())); requestMap.putMap(SENDER_ADDRESS_MC.convert(sender.getAddress())); }
SenderV2MapConverter extends AbstractMapConverter<Sender> { @Override protected void convert(RequestMap requestMap, Sender sender) { requestMap.putString("senderEmail", sender.getEmail()); requestMap.putString("senderName", sender.getName()); requestMap.putString("senderCPF", sender.getCpf()); requestMap.putString("senderCNPJ", sender.getCnpj()); requestMap.putString("senderHash", sender.getHash()); requestMap.putMap(SENDER_PHONE_MC.convert(sender.getPhone())); requestMap.putMap(SENDER_ADDRESS_MC.convert(sender.getAddress())); } }
SenderV2MapConverter extends AbstractMapConverter<Sender> { @Override protected void convert(RequestMap requestMap, Sender sender) { requestMap.putString("senderEmail", sender.getEmail()); requestMap.putString("senderName", sender.getName()); requestMap.putString("senderCPF", sender.getCpf()); requestMap.putString("senderCNPJ", sender.getCnpj()); requestMap.putString("senderHash", sender.getHash()); requestMap.putMap(SENDER_PHONE_MC.convert(sender.getPhone())); requestMap.putMap(SENDER_ADDRESS_MC.convert(sender.getAddress())); }  }
SenderV2MapConverter extends AbstractMapConverter<Sender> { @Override protected void convert(RequestMap requestMap, Sender sender) { requestMap.putString("senderEmail", sender.getEmail()); requestMap.putString("senderName", sender.getName()); requestMap.putString("senderCPF", sender.getCpf()); requestMap.putString("senderCNPJ", sender.getCnpj()); requestMap.putString("senderHash", sender.getHash()); requestMap.putMap(SENDER_PHONE_MC.convert(sender.getPhone())); requestMap.putMap(SENDER_ADDRESS_MC.convert(sender.getAddress())); }   }
SenderV2MapConverter extends AbstractMapConverter<Sender> { @Override protected void convert(RequestMap requestMap, Sender sender) { requestMap.putString("senderEmail", sender.getEmail()); requestMap.putString("senderName", sender.getName()); requestMap.putString("senderCPF", sender.getCpf()); requestMap.putString("senderCNPJ", sender.getCnpj()); requestMap.putString("senderHash", sender.getHash()); requestMap.putMap(SENDER_PHONE_MC.convert(sender.getPhone())); requestMap.putMap(SENDER_ADDRESS_MC.convert(sender.getAddress())); }    }