@Test public void convertSingleElementShouldReturnConvertedObjectWhenProperParametersWereGiven() { TestClass1 source = new TestClass1(TEST_CLASS_FIRST_ID); TestClass2 expected = new TestClass2(TEST_CLASS_FIRST_ID); given(modelMapper.map(source, TestClass2.class)).willReturn(expected); TestClass2 result = modelMapperConverterService.convert(source, TestClass2.class); assertThat(result, notNullValue()); assertThat(result, is(expected)); then(modelMapper).should().map(source, TestClass2.class); }
@Override public <S, T> T convert(S source, Class<T> targetType) { Assert.notNull(source); Assert.notNull(targetType); return modelMapper.map(source, targetType); }
ModelMapperConverterServiceImpl implements ConverterService { @Override public <S, T> T convert(S source, Class<T> targetType) { Assert.notNull(source); Assert.notNull(targetType); return modelMapper.map(source, targetType); } }
ModelMapperConverterServiceImpl implements ConverterService { @Override public <S, T> T convert(S source, Class<T> targetType) { Assert.notNull(source); Assert.notNull(targetType); return modelMapper.map(source, targetType); } ModelMapperConverterServiceImpl(ModelMapper modelMapper); }
ModelMapperConverterServiceImpl implements ConverterService { @Override public <S, T> T convert(S source, Class<T> targetType) { Assert.notNull(source); Assert.notNull(targetType); return modelMapper.map(source, targetType); } 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 { @Override public <S, T> T convert(S source, Class<T> targetType) { Assert.notNull(source); Assert.notNull(targetType); return modelMapper.map(source, targetType); } 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);  }