|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2020 the original author or authors.
|
|
|
|
|
* Copyright 2012-2022 the original author or authors.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
@ -53,8 +53,8 @@ class InputStreamSourceToByteArrayConverterTests {
|
|
|
|
|
InputStreamSource source = mock(InputStreamSource.class);
|
|
|
|
|
given(source.getInputStream()).willThrow(IOException.class);
|
|
|
|
|
assertThatExceptionOfType(ConversionFailedException.class)
|
|
|
|
|
.isThrownBy(() -> conversionService.convert(source, byte[].class))
|
|
|
|
|
.withCauseExactlyInstanceOf(IllegalStateException.class)
|
|
|
|
|
.isThrownBy(() -> conversionService.convert(source, byte[].class)).havingCause()
|
|
|
|
|
.isInstanceOf(IllegalStateException.class)
|
|
|
|
|
.withMessageContaining("Unable to read from input stream source");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -66,9 +66,8 @@ class InputStreamSourceToByteArrayConverterTests {
|
|
|
|
|
given(source.getInputStream()).willThrow(IOException.class);
|
|
|
|
|
given(((OriginProvider) source).getOrigin()).willReturn(origin);
|
|
|
|
|
assertThatExceptionOfType(ConversionFailedException.class)
|
|
|
|
|
.isThrownBy(() -> conversionService.convert(source, byte[].class))
|
|
|
|
|
.withCauseExactlyInstanceOf(IllegalStateException.class)
|
|
|
|
|
.withMessageContaining("Unable to read from mylocation");
|
|
|
|
|
.isThrownBy(() -> conversionService.convert(source, byte[].class)).havingCause()
|
|
|
|
|
.isInstanceOf(IllegalStateException.class).withMessageContaining("Unable to read from mylocation");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ConversionServiceTest
|
|
|
|
@ -78,9 +77,8 @@ class InputStreamSourceToByteArrayConverterTests {
|
|
|
|
|
given(source.getInputStream()).willThrow(IOException.class);
|
|
|
|
|
given(source.getDescription()).willReturn("myresource");
|
|
|
|
|
assertThatExceptionOfType(ConversionFailedException.class)
|
|
|
|
|
.isThrownBy(() -> conversionService.convert(source, byte[].class))
|
|
|
|
|
.withCauseExactlyInstanceOf(IllegalStateException.class)
|
|
|
|
|
.withMessageContaining("Unable to read from myresource");
|
|
|
|
|
.isThrownBy(() -> conversionService.convert(source, byte[].class)).havingCause()
|
|
|
|
|
.isInstanceOf(IllegalStateException.class).withMessageContaining("Unable to read from myresource");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Stream<? extends Arguments> conversionServices() {
|
|
|
|
|