|
|
@ -30,6 +30,7 @@ import org.springframework.format.support.DefaultFormattingConversionService;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
|
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
|
|
|
|
|
|
import static org.mockito.ArgumentMatchers.eq;
|
|
|
|
import static org.mockito.BDDMockito.given;
|
|
|
|
import static org.mockito.BDDMockito.given;
|
|
|
|
import static org.mockito.BDDMockito.then;
|
|
|
|
import static org.mockito.BDDMockito.then;
|
|
|
|
import static org.mockito.Mockito.mock;
|
|
|
|
import static org.mockito.Mockito.mock;
|
|
|
@ -55,7 +56,7 @@ class ConversionServiceParameterValueMapperTests {
|
|
|
|
void mapParameterWhenConversionServiceFailsShouldThrowParameterMappingException() {
|
|
|
|
void mapParameterWhenConversionServiceFailsShouldThrowParameterMappingException() {
|
|
|
|
ConversionService conversionService = mock(ConversionService.class);
|
|
|
|
ConversionService conversionService = mock(ConversionService.class);
|
|
|
|
RuntimeException error = new RuntimeException();
|
|
|
|
RuntimeException error = new RuntimeException();
|
|
|
|
given(conversionService.convert(any(), any())).willThrow(error);
|
|
|
|
given(conversionService.convert(any(Object.class), eq(Integer.class))).willThrow(error);
|
|
|
|
ConversionServiceParameterValueMapper mapper = new ConversionServiceParameterValueMapper(conversionService);
|
|
|
|
ConversionServiceParameterValueMapper mapper = new ConversionServiceParameterValueMapper(conversionService);
|
|
|
|
assertThatExceptionOfType(ParameterMappingException.class)
|
|
|
|
assertThatExceptionOfType(ParameterMappingException.class)
|
|
|
|
.isThrownBy(() -> mapper.mapParameterValue(new TestOperationParameter(Integer.class), "123"))
|
|
|
|
.isThrownBy(() -> mapper.mapParameterValue(new TestOperationParameter(Integer.class), "123"))
|
|
|
|