Skip to content

Commit

Permalink
fixed RemoteResponseTest (zalando#1436)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianLohmann authored Feb 27, 2023
1 parent 32a8ac0 commit 1b00c7e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.jupiter.api.Test;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.mock.http.client.MockClientHttpResponse;

import java.io.IOException;
Expand All @@ -15,9 +16,9 @@ class RemoteResponseTest {

@Test
void statusCanThrow() throws IOException {
MockClientHttpResponse response = mock(MockClientHttpResponse.class);
ClientHttpResponse response = mock(ClientHttpResponse.class);
when(response.getRawStatusCode()).thenThrow(new IOException("io exception"));
assertThatThrownBy(() -> unit(response).getStatus()).hasMessageContaining("io exception");
assertThatThrownBy(() -> new RemoteResponse(response).getStatus()).hasMessageContaining("io exception");
}

@Test
Expand All @@ -34,7 +35,7 @@ private MockClientHttpResponse helloWorld() {
return new MockClientHttpResponse("hello world".getBytes(), HttpStatus.OK);
}

private org.zalando.logbook.HttpResponse unit(MockClientHttpResponse response) {
private org.zalando.logbook.HttpResponse unit(ClientHttpResponse response) {
return new RemoteResponse(response);
}
}

0 comments on commit 1b00c7e

Please sign in to comment.