diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2022-05-20 12:18:46 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-05-31 20:02:50 +0000 |
commit | 5dc735487ccaa4fd9557a2bc99b1654756c65d8d (patch) | |
tree | 163d8c5faf74096c50a87bc6247c0ffac76333e7 /sonar-scanner-engine/src/test/java | |
parent | cc058a386950f69d40a6d422f2927c3f92857724 (diff) | |
download | sonarqube-5dc735487ccaa4fd9557a2bc99b1654756c65d8d.tar.gz sonarqube-5dc735487ccaa4fd9557a2bc99b1654756c65d8d.zip |
SONAR-16260 improve project analysis when using project analysis token
Diffstat (limited to 'sonar-scanner-engine/src/test/java')
9 files changed, 50 insertions, 82 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java index 157c0745b5e..45905619f03 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java @@ -25,7 +25,6 @@ import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; import org.mockito.ArgumentMatcher; import org.sonar.scanner.bootstrap.DefaultScannerWsClient; -import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsRequest; import org.sonarqube.ws.client.WsResponse; @@ -39,19 +38,19 @@ public class WsTestUtil { public static void mockStream(DefaultScannerWsClient mock, String path, InputStream is) { WsResponse response = mock(WsResponse.class); when(response.contentStream()).thenReturn(is); - when(mock.call((GetRequest) argThat(new RequestMatcher(path)))).thenReturn(response); + when(mock.call(argThat(new RequestMatcher(path)))).thenReturn(response); } public static void mockStream(DefaultScannerWsClient mock, InputStream is) { WsResponse response = mock(WsResponse.class); when(response.contentStream()).thenReturn(is); - when(mock.call(any(GetRequest.class))).thenReturn(response); + when(mock.call(any(WsRequest.class))).thenReturn(response); } public static void mockReader(DefaultScannerWsClient mock, Reader reader) { WsResponse response = mock(WsResponse.class); when(response.contentReader()).thenReturn(reader); - when(mock.call(any(GetRequest.class))).thenReturn(response); + when(mock.call(any(WsRequest.class))).thenReturn(response); } public static void mockReader(DefaultScannerWsClient mock, String path, Reader reader, Reader... others) { @@ -64,19 +63,19 @@ public class WsTestUtil { otherResponses[i] = otherResponse; } - when(mock.call((GetRequest) argThat(new RequestMatcher(path)))).thenReturn(response, otherResponses); + when(mock.call(argThat(new RequestMatcher(path)))).thenReturn(response, otherResponses); } public static void mockException(DefaultScannerWsClient mock, Exception e) { - when(mock.call(any(GetRequest.class))).thenThrow(e); + when(mock.call(any(WsRequest.class))).thenThrow(e); } public static void mockException(DefaultScannerWsClient mock, String path, Exception e) { - when(mock.call((GetRequest) argThat(new RequestMatcher(path)))).thenThrow(e); + when(mock.call(argThat(new RequestMatcher(path)))).thenThrow(e); } public static void verifyCall(DefaultScannerWsClient mock, String path) { - verify(mock).call((GetRequest) argThat(new RequestMatcher(path))); + verify(mock).call(argThat(new RequestMatcher(path))); } private static class RequestMatcher implements ArgumentMatcher<WsRequest> { diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DefaultScannerWsClientTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DefaultScannerWsClientTest.java index 20dc164f075..752b6ef0891 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DefaultScannerWsClientTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DefaultScannerWsClientTest.java @@ -19,9 +19,9 @@ */ package org.sonar.scanner.bootstrap; +import java.util.Collections; import java.util.List; import org.apache.commons.lang.StringUtils; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.mockito.Mockito; @@ -31,8 +31,8 @@ import org.sonar.api.utils.log.LoggerLevel; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.MockWsResponse; -import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; +import org.sonarqube.ws.client.WsRequest; import org.sonarqube.ws.client.WsResponse; import static org.assertj.core.api.Assertions.assertThat; @@ -47,22 +47,14 @@ public class DefaultScannerWsClientTest { private final WsClient wsClient = mock(WsClient.class, Mockito.RETURNS_DEEP_STUBS); - private final ScannerProperties scannerProperties = mock(ScannerProperties.class); - - @Before - public void before() { - when(scannerProperties.getProjectKey()).thenReturn("projectKey"); - } - @Test public void log_and_profile_request_if_debug_level() { - GetRequest request = newGetRequest(); + WsRequest request = newRequest(); WsResponse response = newResponse().setRequestUrl("https://local/api/issues/search"); when(wsClient.wsConnector().call(request)).thenReturn(response); logTester.setLevel(LoggerLevel.DEBUG); - DefaultScannerWsClient underTest = new DefaultScannerWsClient(wsClient, false, new GlobalAnalysisMode(scannerProperties), - scannerProperties); + DefaultScannerWsClient underTest = new DefaultScannerWsClient(wsClient, false, new GlobalAnalysisMode(new ScannerProperties(Collections.emptyMap()))); WsResponse result = underTest.call(request); @@ -76,21 +68,6 @@ public class DefaultScannerWsClientTest { } @Test - public void call_alwaysAddContextHeaders() { - GetRequest getRequest = newGetRequest(); - PostRequest postRequest = newPostRequest(); - - DefaultScannerWsClient underTest = new DefaultScannerWsClient(wsClient, false, new GlobalAnalysisMode(scannerProperties), - scannerProperties); - - underTest.call(getRequest); - underTest.call(postRequest); - - assertThat(getRequest.getHeaders().getValue("PROJECT_KEY")).contains("projectKey"); - assertThat(postRequest.getHeaders().getValue("PROJECT_KEY")).contains("projectKey"); - } - - @Test public void create_error_msg_from_json() { String content = "{\"errors\":[{\"msg\":\"missing scan permission\"}, {\"msg\":\"missing another permission\"}]}"; assertThat(DefaultScannerWsClient.createErrorMessage(new HttpException("url", 400, content))).isEqualTo("missing scan permission, missing another permission"); @@ -110,12 +87,12 @@ public class DefaultScannerWsClientTest { @Test public void fail_if_requires_credentials() { - GetRequest request = newGetRequest(); + WsRequest request = newRequest(); WsResponse response = newResponse().setCode(401); when(wsClient.wsConnector().call(request)).thenReturn(response); assertThatThrownBy(() -> new DefaultScannerWsClient(wsClient, false, - new GlobalAnalysisMode(scannerProperties), scannerProperties).call(request)) + new GlobalAnalysisMode(new ScannerProperties(Collections.emptyMap()))).call(request)) .isInstanceOf(MessageException.class) .hasMessage("Not authorized. Analyzing this project requires authentication. Please provide a user token in sonar.login or other " + "credentials in sonar.login and sonar.password."); @@ -123,39 +100,39 @@ public class DefaultScannerWsClientTest { @Test public void fail_if_credentials_are_not_valid() { - GetRequest request = newGetRequest(); + WsRequest request = newRequest(); WsResponse response = newResponse().setCode(401); when(wsClient.wsConnector().call(request)).thenReturn(response); assertThatThrownBy(() -> new DefaultScannerWsClient(wsClient, /* credentials are configured */true, - new GlobalAnalysisMode(scannerProperties), scannerProperties).call(request)) + new GlobalAnalysisMode(new ScannerProperties(Collections.emptyMap()))).call(request)) .isInstanceOf(MessageException.class) .hasMessage("Not authorized. Please check the properties sonar.login and sonar.password."); } @Test public void fail_if_requires_permission() { - GetRequest request = newGetRequest(); + WsRequest request = newRequest(); WsResponse response = newResponse() .setCode(403); when(wsClient.wsConnector().call(request)).thenReturn(response); assertThatThrownBy(() -> new DefaultScannerWsClient(wsClient, true, - new GlobalAnalysisMode(scannerProperties), scannerProperties).call(request)) + new GlobalAnalysisMode(new ScannerProperties(Collections.emptyMap()))).call(request)) .isInstanceOf(MessageException.class) .hasMessage("You're not authorized to run analysis. Please contact the project administrator."); } @Test public void fail_if_bad_request() { - GetRequest request = newGetRequest(); + WsRequest request = newRequest(); WsResponse response = newResponse() .setCode(400) .setContent("{\"errors\":[{\"msg\":\"Boo! bad request! bad!\"}]}"); when(wsClient.wsConnector().call(request)).thenReturn(response); assertThatThrownBy(() -> new DefaultScannerWsClient(wsClient, true, - new GlobalAnalysisMode(scannerProperties), scannerProperties).call(request)) + new GlobalAnalysisMode(new ScannerProperties(Collections.emptyMap()))).call(request)) .isInstanceOf(MessageException.class) .hasMessage("Boo! bad request! bad!"); } @@ -164,11 +141,7 @@ public class DefaultScannerWsClientTest { return new MockWsResponse().setRequestUrl("https://local/api/issues/search"); } - private GetRequest newGetRequest() { + private WsRequest newRequest() { return new GetRequest("api/issues/search"); } - - private PostRequest newPostRequest() { - return new PostRequest("api/ce/task"); - } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PluginFilesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PluginFilesTest.java index 0c726b4035a..d2b7cd4840d 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PluginFilesTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PluginFilesTest.java @@ -47,7 +47,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.api.batch.fs.internal.DefaultInputProject; import org.sonar.api.config.internal.MapSettings; import org.sonar.scanner.bootstrap.ScannerPluginInstaller.InstalledPlugin; import org.sonarqube.ws.client.HttpConnector; @@ -57,7 +56,6 @@ import static org.apache.commons.io.FileUtils.moveFile; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.ThrowableAssert.ThrowingCallable; -import static org.mockito.Mockito.mock; public class PluginFilesTest { @@ -74,7 +72,7 @@ public class PluginFilesTest { HttpConnector connector = HttpConnector.newBuilder().url(server.url("/").toString()).build(); GlobalAnalysisMode analysisMode = new GlobalAnalysisMode(new ScannerProperties(Collections.emptyMap())); DefaultScannerWsClient wsClient = new DefaultScannerWsClient(WsClientFactories.getDefault().newClient(connector), false, - analysisMode, mock(ScannerProperties.class)); + analysisMode); userHome = temp.newFolder(); MapSettings settings = new MapSettings(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cache/DefaultAnalysisCacheLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cache/DefaultAnalysisCacheLoaderTest.java index be8ad554eca..3281d457a7d 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cache/DefaultAnalysisCacheLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cache/DefaultAnalysisCacheLoaderTest.java @@ -35,8 +35,8 @@ import org.sonar.api.utils.MessageException; import org.sonar.scanner.bootstrap.DefaultScannerWsClient; import org.sonar.scanner.protocol.internal.ScannerInternal.AnalysisCacheMsg; import org.sonar.scanner.scan.branch.BranchConfiguration; -import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpException; +import org.sonarqube.ws.client.WsRequest; import org.sonarqube.ws.client.WsResponse; import static org.assertj.core.api.Assertions.assertThat; @@ -60,7 +60,7 @@ public class DefaultAnalysisCacheLoaderTest { @Before public void before() { when(project.key()).thenReturn("myproject"); - when(wsClient.call(any(GetRequest.class))).thenReturn(response); + when(wsClient.call(any())).thenReturn(response); } @Test @@ -91,13 +91,13 @@ public class DefaultAnalysisCacheLoaderTest { @Test public void returns_empty_if_404() { - when(wsClient.call(any(GetRequest.class))).thenThrow(new HttpException("url", 404, "content")); + when(wsClient.call(any())).thenThrow(new HttpException("url", 404, "content")); assertThat(loader.load()).isEmpty(); } @Test public void throw_error_if_http_exception_not_404() { - when(wsClient.call(any(GetRequest.class))).thenThrow(new HttpException("url", 401, "content")); + when(wsClient.call(any())).thenThrow(new HttpException("url", 401, "content")); assertThatThrownBy(loader::load) .isInstanceOf(MessageException.class) .hasMessage("Failed to download analysis cache: HTTP code 401: content"); @@ -112,7 +112,7 @@ public class DefaultAnalysisCacheLoaderTest { } private void assertRequestPath(String expectedPath) { - ArgumentCaptor<GetRequest> requestCaptor = ArgumentCaptor.forClass(GetRequest.class); + ArgumentCaptor<WsRequest> requestCaptor = ArgumentCaptor.forClass(WsRequest.class); verify(wsClient).call(requestCaptor.capture()); assertThat(requestCaptor.getValue().getPath()).isEqualTo(expectedPath); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/qualitygate/QualityGateCheckTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/qualitygate/QualityGateCheckTest.java index 89613f6bba0..bd3803a7eb1 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/qualitygate/QualityGateCheckTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/qualitygate/QualityGateCheckTest.java @@ -38,9 +38,9 @@ import org.sonarqube.ws.Ce; import org.sonarqube.ws.Ce.TaskStatus; import org.sonarqube.ws.Qualitygates; import org.sonarqube.ws.Qualitygates.ProjectStatusResponse.Status; -import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.MockWsResponse; +import org.sonarqube.ws.client.WsRequest; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -266,8 +266,8 @@ public class QualityGateCheckTest { .hasMessageContaining("CE Task finished abnormally with status: " + taskStatus.name()); } - private GetRequest newGetCeTaskRequest() { - return argThat(new GetRequestPathMatcher("api/ce/task")); + private WsRequest newGetCeTaskRequest() { + return argThat(new WsRequestPathMatcher("api/ce/task")); } private MockWsResponse getCeTaskWsResponse(TaskStatus status) { @@ -302,8 +302,8 @@ public class QualityGateCheckTest { .isInstanceOf(IllegalStateException.class); } - private GetRequest newGetQualityGateRequest() { - return argThat(new GetRequestPathMatcher("api/qualitygates/project_status")); + private WsRequest newGetQualityGateRequest() { + return argThat(new WsRequestPathMatcher("api/qualitygates/project_status")); } private MockWsResponse getQualityGateWsResponse(Status status) { @@ -325,15 +325,15 @@ public class QualityGateCheckTest { }; } - private static class GetRequestPathMatcher implements ArgumentMatcher<GetRequest> { + private static class WsRequestPathMatcher implements ArgumentMatcher<WsRequest> { String path; - GetRequestPathMatcher(String path) { + WsRequestPathMatcher(String path) { this.path = path; } @Override - public boolean matches(GetRequest right) { + public boolean matches(WsRequest right) { return path.equals(right.getPath()); } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java index 55d6772e37e..cc440601a2f 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java @@ -45,7 +45,6 @@ import org.sonar.scanner.scan.branch.BranchConfiguration; import org.sonarqube.ws.Ce; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.MockWsResponse; -import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsRequest; import org.sonarqube.ws.client.WsResponse; @@ -97,12 +96,12 @@ public class ReportPublisherTest { public void use_30s_write_timeout() { MockWsResponse submitMockResponse = new MockWsResponse(); submitMockResponse.setContent(Ce.SubmitResponse.newBuilder().setTaskId("task-1234").build().toByteArray()); - when(wsClient.call(any(PostRequest.class))).thenReturn(submitMockResponse); + when(wsClient.call(any())).thenReturn(submitMockResponse); underTest.start(); underTest.execute(); - verify(wsClient).call((PostRequest) argThat(req -> ((PostRequest) req).getWriteTimeOutInMs().orElse(0) == 30_000)); + verify(wsClient).call(argThat(req -> (req).getWriteTimeOutInMs().orElse(0) == 30_000)); } @Test @@ -123,7 +122,7 @@ public class ReportPublisherTest { HttpException ex = new HttpException("url", 404, "{\"errors\":[{\"msg\":\"Organization with key 'MyOrg' does not exist\"}]}"); WsResponse response = mock(WsResponse.class); when(response.failIfNotSuccessful()).thenThrow(ex); - when(wsClient.call(any(PostRequest.class))).thenThrow(new IllegalStateException("timeout")); + when(wsClient.call(any(WsRequest.class))).thenThrow(new IllegalStateException("timeout")); assertThatThrownBy(() -> underTest.upload(reportTempFolder.newFile())) .isInstanceOf(IllegalStateException.class) @@ -135,7 +134,7 @@ public class ReportPublisherTest { HttpException ex = new HttpException("url", 404, "{\"errors\":[{\"msg\":\"Organization with key 'MyOrg' does not exist\"}]}"); WsResponse response = mock(WsResponse.class); when(response.failIfNotSuccessful()).thenThrow(ex); - when(wsClient.call(any(PostRequest.class))).thenReturn(response); + when(wsClient.call(any(WsRequest.class))).thenReturn(response); assertThatThrownBy(() -> underTest.upload(reportTempFolder.newFile())) .isInstanceOf(MessageException.class) @@ -226,7 +225,7 @@ public class ReportPublisherTest { MockWsResponse submitMockResponse = new MockWsResponse(); submitMockResponse.setContent(Ce.SubmitResponse.newBuilder().setTaskId("task-1234").build().toByteArray()); - when(wsClient.call(any(PostRequest.class))).thenReturn(submitMockResponse); + when(wsClient.call(any())).thenReturn(submitMockResponse); underTest.start(); underTest.execute(); @@ -277,10 +276,10 @@ public class ReportPublisherTest { when(response.failIfNotSuccessful()).thenReturn(response); when(response.contentStream()).thenReturn(in); - when(wsClient.call(any(PostRequest.class))).thenReturn(response); + when(wsClient.call(any(WsRequest.class))).thenReturn(response); underTest.upload(reportTempFolder.newFile()); - ArgumentCaptor<PostRequest> capture = ArgumentCaptor.forClass(PostRequest.class); + ArgumentCaptor<WsRequest> capture = ArgumentCaptor.forClass(WsRequest.class); verify(wsClient).call(capture.capture()); WsRequest wsRequest = capture.getValue(); @@ -304,10 +303,10 @@ public class ReportPublisherTest { when(response.failIfNotSuccessful()).thenReturn(response); when(response.contentStream()).thenReturn(in); - when(wsClient.call(any(PostRequest.class))).thenReturn(response); + when(wsClient.call(any(WsRequest.class))).thenReturn(response); underTest.upload(reportTempFolder.newFile()); - ArgumentCaptor<PostRequest> capture = ArgumentCaptor.forClass(PostRequest.class); + ArgumentCaptor<WsRequest> capture = ArgumentCaptor.forClass(WsRequest.class); verify(wsClient).call(capture.capture()); WsRequest wsRequest = capture.getValue(); @@ -335,10 +334,10 @@ public class ReportPublisherTest { when(response.failIfNotSuccessful()).thenReturn(response); when(response.contentStream()).thenReturn(in); - when(wsClient.call(any(PostRequest.class))).thenReturn(response); + when(wsClient.call(any(WsRequest.class))).thenReturn(response); underTest.upload(reportTempFolder.newFile()); - ArgumentCaptor<PostRequest> capture = ArgumentCaptor.forClass(PostRequest.class); + ArgumentCaptor<WsRequest> capture = ArgumentCaptor.forClass(WsRequest.class); verify(wsClient).call(capture.capture()); WsRequest wsRequest = capture.getValue(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java index ca09e2bd359..829095bc81b 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java @@ -32,7 +32,6 @@ import org.sonar.api.utils.MessageException; import org.sonar.scanner.WsTestUtil; import org.sonar.scanner.bootstrap.DefaultScannerWsClient; import org.sonarqube.ws.Batch.WsProjectResponse; -import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpException; import static org.assertj.core.api.Assertions.assertThat; @@ -58,14 +57,14 @@ public class DefaultProjectRepositoriesLoaderTest { @Test public void continueOnHttp404Exception() { - when(wsClient.call(any(GetRequest.class))).thenThrow(new HttpException("/batch/project.protobuf?key=foo%3F", HttpURLConnection.HTTP_NOT_FOUND, "")); + when(wsClient.call(any())).thenThrow(new HttpException("/batch/project.protobuf?key=foo%3F", HttpURLConnection.HTTP_NOT_FOUND, "")); ProjectRepositories proj = loader.load(PROJECT_KEY, null); assertThat(proj.exists()).isFalse(); } @Test(expected = IllegalStateException.class) public void failOnNonHttp404Exception() { - when(wsClient.call(any(GetRequest.class))).thenThrow(IllegalStateException.class); + when(wsClient.call(any())).thenThrow(IllegalStateException.class); ProjectRepositories proj = loader.load(PROJECT_KEY, null); assertThat(proj.exists()).isFalse(); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/settings/DefaultGlobalSettingsLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/settings/DefaultGlobalSettingsLoaderTest.java index daae92c11c2..069d7a85fb2 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/settings/DefaultGlobalSettingsLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/settings/DefaultGlobalSettingsLoaderTest.java @@ -58,7 +58,7 @@ public class DefaultGlobalSettingsLoaderTest { .writeTo(out); out.close(); when(response.contentStream()).thenReturn(in); - when(wsClient.call(any(GetRequest.class))).thenReturn(response); + when(wsClient.call(any())).thenReturn(response); Map<String, String> result = underTest.loadGlobalSettings(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/settings/DefaultProjectSettingsLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/settings/DefaultProjectSettingsLoaderTest.java index 9699b433258..ae6e98cd7ac 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/settings/DefaultProjectSettingsLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/settings/DefaultProjectSettingsLoaderTest.java @@ -25,8 +25,8 @@ import java.io.PipedOutputStream; import java.util.Map; import org.junit.Test; import org.mockito.ArgumentCaptor; -import org.sonar.scanner.bootstrap.ScannerProperties; import org.sonar.scanner.bootstrap.DefaultScannerWsClient; +import org.sonar.scanner.bootstrap.ScannerProperties; import org.sonarqube.ws.Settings; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; @@ -60,7 +60,7 @@ public class DefaultProjectSettingsLoaderTest { .writeTo(out); out.close(); when(response.contentStream()).thenReturn(in); - when(wsClient.call(any(GetRequest.class))).thenReturn(response); + when(wsClient.call(any())).thenReturn(response); when(properties.getProjectKey()).thenReturn("project_key"); Map<String, String> result = underTest.loadProjectSettings(); |