use of com.thoughtworks.go.domain.FetchHandler in project gocd by gocd.
the class HttpServiceTest method shouldDownloadArtifact.
@Test
public void shouldDownloadArtifact() throws IOException {
String url = "http://blah";
FetchHandler fetchHandler = mock(FetchHandler.class);
HttpGet mockGetMethod = mock(HttpGet.class);
CloseableHttpResponse response = mock(CloseableHttpResponse.class);
when(response.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, 200, "OK"));
when(httpClient.execute(mockGetMethod)).thenReturn(response);
when(httpClientFactory.createGet(url)).thenReturn(mockGetMethod);
service.download(url, fetchHandler);
verify(httpClient).execute(mockGetMethod);
verify(fetchHandler).handle(null);
}
Aggregations