@Test(expected = IllegalArgumentException.class) public void setupCustomConvertersShouldThrowIllegalArgumentExceptionWhenConverterAdapterListIsNull() { modelMapperConverterService.setupCustomConverters(null); }
public void setupCustomConverters(List<ConverterAdapter> converterAdapters) { Assert.notNull(converterAdapters); for (ConverterAdapter c : converterAdapters) { modelMapper.createTypeMap(c.getSourceClass(), c.getTargetClass()) .setConverter(context -> c.getConverter().convert(context.getSource())); } }
ModelMapperConverterServiceImpl implements ConverterService { public void setupCustomConverters(List<ConverterAdapter> converterAdapters) { Assert.notNull(converterAdapters); for (ConverterAdapter c : converterAdapters) { modelMapper.createTypeMap(c.getSourceClass(), c.getTargetClass()) .setConverter(context -> c.getConverter().convert(context.getSource())); } } }
ModelMapperConverterServiceImpl implements ConverterService { public void setupCustomConverters(List<ConverterAdapter> converterAdapters) { Assert.notNull(converterAdapters); for (ConverterAdapter c : converterAdapters) { modelMapper.createTypeMap(c.getSourceClass(), c.getTargetClass()) .setConverter(context -> c.getConverter().convert(context.getSource())); } } ModelMapperConverterServiceImpl(ModelMapper modelMapper); }
ModelMapperConverterServiceImpl implements ConverterService { public void setupCustomConverters(List<ConverterAdapter> converterAdapters) { Assert.notNull(converterAdapters); for (ConverterAdapter c : converterAdapters) { modelMapper.createTypeMap(c.getSourceClass(), c.getTargetClass()) .setConverter(context -> c.getConverter().convert(context.getSource())); } } ModelMapperConverterServiceImpl(ModelMapper modelMapper); void setupCustomConverters(List<ConverterAdapter> converterAdapters); @Override T convert(S source, Class<T> targetType); @Override List<T> convert(List<S> sourceList, Class<T> targetType); }
ModelMapperConverterServiceImpl implements ConverterService { public void setupCustomConverters(List<ConverterAdapter> converterAdapters) { Assert.notNull(converterAdapters); for (ConverterAdapter c : converterAdapters) { modelMapper.createTypeMap(c.getSourceClass(), c.getTargetClass()) .setConverter(context -> c.getConverter().convert(context.getSource())); } } ModelMapperConverterServiceImpl(ModelMapper modelMapper); void setupCustomConverters(List<ConverterAdapter> converterAdapters); @Override T convert(S source, Class<T> targetType); @Override List<T> convert(List<S> sourceList, Class<T> targetType);  }