Skip to content

Commit

Permalink
Fixed and renamed ioExceptionInErrorDeserializationReturnsEmpty() i…
Browse files Browse the repository at this point in the history
…n `HttpResponseBodyDecoderTests`. (Azure#37522)

* Fixed a and renamed ioExceptionInErrorDeserializationReturnsEmpty() in HttpResponseBodyDecoderTests to ioExceptionInErrorDeserializationReturnsException().

* Applied PR feedback.
  • Loading branch information
vcolin7 authored Nov 6, 2023
1 parent 40baab9 commit a2faeb2
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import reactor.test.StepVerifier;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.nio.ByteBuffer;
Expand All @@ -45,6 +44,7 @@
import static com.azure.core.CoreTestUtils.assertArraysEqual;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -117,11 +117,10 @@ private static Stream<Arguments> errorResponseSupplier() {
}

@Test
public void ioExceptionInErrorDeserializationReturnsEmpty() {
public void ioExceptionInErrorDeserializationReturnsException() {
JacksonAdapter ioExceptionThrower = new JacksonAdapter() {
@Override
public <T> T deserialize(InputStream inputStream, Type type, SerializerEncoding encoding)
throws IOException {
public <T> T deserialize(byte[] bytes, Type type, SerializerEncoding encoding) throws IOException {
throw new IOException();
}
};
Expand All @@ -131,7 +130,8 @@ public <T> T deserialize(InputStream inputStream, Type type, SerializerEncoding

HttpResponse response = new MockHttpResponse(GET_REQUEST, 300);

assertNull(HttpResponseBodyDecoder.decodeByteArray(null, response, ioExceptionThrower, noExpectedStatusCodes));
assertInstanceOf(IOException.class,
HttpResponseBodyDecoder.decodeByteArray(null, response, ioExceptionThrower, noExpectedStatusCodes));
}

@Test
Expand Down

0 comments on commit a2faeb2

Please sign in to comment.