Skip to content

Commit a2faeb2

Browse files
authored
Fixed and renamed ioExceptionInErrorDeserializationReturnsEmpty() in HttpResponseBodyDecoderTests. (Azure#37522)
* Fixed a and renamed ioExceptionInErrorDeserializationReturnsEmpty() in HttpResponseBodyDecoderTests to ioExceptionInErrorDeserializationReturnsException(). * Applied PR feedback.
1 parent 40baab9 commit a2faeb2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sdk/core/azure-core/src/test/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoderTests.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import reactor.test.StepVerifier;
3030

3131
import java.io.IOException;
32-
import java.io.InputStream;
3332
import java.lang.reflect.ParameterizedType;
3433
import java.lang.reflect.Type;
3534
import java.nio.ByteBuffer;
@@ -45,6 +44,7 @@
4544
import static com.azure.core.CoreTestUtils.assertArraysEqual;
4645
import static org.junit.jupiter.api.Assertions.assertEquals;
4746
import static org.junit.jupiter.api.Assertions.assertFalse;
47+
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
4848
import static org.junit.jupiter.api.Assertions.assertNull;
4949
import static org.junit.jupiter.api.Assertions.assertThrows;
5050
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -117,11 +117,10 @@ private static Stream<Arguments> errorResponseSupplier() {
117117
}
118118

119119
@Test
120-
public void ioExceptionInErrorDeserializationReturnsEmpty() {
120+
public void ioExceptionInErrorDeserializationReturnsException() {
121121
JacksonAdapter ioExceptionThrower = new JacksonAdapter() {
122122
@Override
123-
public <T> T deserialize(InputStream inputStream, Type type, SerializerEncoding encoding)
124-
throws IOException {
123+
public <T> T deserialize(byte[] bytes, Type type, SerializerEncoding encoding) throws IOException {
125124
throw new IOException();
126125
}
127126
};
@@ -131,7 +130,8 @@ public <T> T deserialize(InputStream inputStream, Type type, SerializerEncoding
131130

132131
HttpResponse response = new MockHttpResponse(GET_REQUEST, 300);
133132

134-
assertNull(HttpResponseBodyDecoder.decodeByteArray(null, response, ioExceptionThrower, noExpectedStatusCodes));
133+
assertInstanceOf(IOException.class,
134+
HttpResponseBodyDecoder.decodeByteArray(null, response, ioExceptionThrower, noExpectedStatusCodes));
135135
}
136136

137137
@Test

0 commit comments

Comments
 (0)