ResponseStatusMapper extends AbstractParameterMapper<ResponseStatus> implements CustomConverter { @Override public ResponseStatus fromParameters(Map<String, Object> source, ResponseStatus responseStatus) throws MappingException { GeosupportReturnCode rc1 = responseStatus.getGeosupportReturnCode(); if (rc1 == null) { rc1 = new GeosupportReturnCode(); responseStatus.setGeosupportReturnCode(rc1); } convertToGeosupportReturnCodeOne(source, rc1); GeosupportReturnCode rc2 = responseStatus.getGeosupportReturnCode2(); if (rc2 == null) { rc2 = new GeosupportReturnCode(); responseStatus.setGeosupportReturnCode2(rc2); } convertToGeosupportReturnCodeTwo(source, rc2); List<String> similarNames = responseStatus.getSimilarNames(); similarNames = similarNames != null ? similarNames : new ArrayList<>(); convertToSimilarNamesList(source, similarNames); return responseStatus; } ResponseStatusMapper(); @Override ResponseStatus fromParameters(Map<String, Object> source, ResponseStatus responseStatus); @Override Map<String, Object> toParameters(ResponseStatus responseStatus, Map<String, Object> map); @SuppressWarnings("unchecked") @Override Object convert(Object destination, Object source, Class<?> destinationClass, Class<?> sourceClass);  }
@Test void testFromParameters_successWithWarning() { MapWrapper wrapMap = MapWrapper.successWithWarning(); Map<String, Object> map = wrapMap.getMap(); ResponseStatus responseStatus = new ResponseStatus(); this.mapper.fromParameters(map, responseStatus); assertEquals(responseStatus.getGeosupportReturnCode().getReturnCode(), wrapMap.getReturnCode1()); assertEquals(responseStatus.getGeosupportReturnCode().getReasonCode(), wrapMap.getReasonCode1()); assertEquals(responseStatus.getGeosupportReturnCode().getMessage(), wrapMap.getMessage1()); assertEquals(responseStatus.getGeosupportReturnCode2().getReturnCode(), wrapMap.getReturnCode2()); assertEquals(responseStatus.getGeosupportReturnCode2().getReasonCode(), wrapMap.getReasonCode2()); assertEquals(responseStatus.getGeosupportReturnCode2().getMessage(), wrapMap.getMessage2()); assertTrue(responseStatus.getSimilarNames().isEmpty()); }