Skip to content

Commit d8191b4

Browse files
committed
Polish contribution
See spring-projectsgh-26984
1 parent 417bce8 commit d8191b4

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

spring-web/src/main/java/org/springframework/web/client/MessageBodyClientHttpResponseWrapper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ class MessageBodyClientHttpResponseWrapper implements ClientHttpResponse {
4242
private PushbackInputStream pushbackInputStream;
4343

4444

45-
public MessageBodyClientHttpResponseWrapper(ClientHttpResponse response) throws IOException {
45+
public MessageBodyClientHttpResponseWrapper(ClientHttpResponse response) {
4646
this.response = response;
4747
}
4848

spring-web/src/test/java/org/springframework/web/client/MessageBodyClientHttpResponseWrapperTests.java

+14-13
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,44 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.web.client;
1718

19+
import java.io.ByteArrayInputStream;
20+
import java.io.InputStream;
21+
1822
import org.junit.jupiter.api.Test;
19-
import org.springframework.http.HttpHeaders;
20-
import org.springframework.http.HttpStatus;
23+
2124
import org.springframework.http.client.ClientHttpResponse;
2225

2326
import static org.assertj.core.api.Assertions.assertThat;
2427
import static org.mockito.BDDMockito.given;
2528
import static org.mockito.Mockito.mock;
2629

27-
import java.io.ByteArrayInputStream;
28-
import java.io.IOException;
29-
import java.io.InputStream;
30-
3130
/**
32-
* Unit tests for {MessageBodyClientHttpResponseWrapper}.
31+
* Unit tests for {@link MessageBodyClientHttpResponseWrapper}.
3332
*
33+
* @since 5.3.10
3434
* @author Yin-Jui Liao
3535
*/
3636
class MessageBodyClientHttpResponseWrapperTests {
3737

3838
private final ClientHttpResponse response = mock(ClientHttpResponse.class);
3939

40+
private final MessageBodyClientHttpResponseWrapper responseWrapper = new MessageBodyClientHttpResponseWrapper(response);
41+
42+
4043
@Test
41-
void testMessageBodyNotExist() throws IOException {
44+
void messageBodyDoesNotExist() throws Exception {
4245
given(response.getBody()).willReturn(null);
43-
MessageBodyClientHttpResponseWrapper responseWrapper = new MessageBodyClientHttpResponseWrapper(response);
4446
assertThat(responseWrapper.hasEmptyMessageBody()).isTrue();
4547
}
4648

4749
@Test
48-
void testMessageBodyExist() throws IOException {
49-
String body = "Accepted request";
50-
InputStream stream = new ByteArrayInputStream(body.getBytes());
50+
void messageBodyExists() throws Exception {
51+
InputStream stream = new ByteArrayInputStream("content".getBytes());
5152
given(response.getBody()).willReturn(stream);
52-
MessageBodyClientHttpResponseWrapper responseWrapper = new MessageBodyClientHttpResponseWrapper(response);
5353
assertThat(responseWrapper.hasEmptyMessageBody()).isFalse();
5454
}
55+
5556
}

0 commit comments

Comments
 (0)