4343import org .junit .jupiter .api .io .TempDir ;
4444import org .junitpioneer .jupiter .RestoreSystemProperties ;
4545import org .sonarsource .scanner .lib .internal .SonarUserHome ;
46- import org .sonarsource .scanner .lib .internal .cache .Logger ;
4746
4847import static com .github .tomakehurst .wiremock .client .WireMock .aResponse ;
4948import static com .github .tomakehurst .wiremock .client .WireMock .anyUrl ;
6059import static org .assertj .core .api .Assertions .assertThat ;
6160import static org .assertj .core .api .Assertions .assertThatThrownBy ;
6261import static org .junit .Assert .assertThrows ;
63- import static org .mockito .Mockito .mock ;
6462
6563class OkHttpClientFactoryTest {
6664
6765 private static final String SONAR_WS_TIMEOUT = "sonar.ws.timeout" ;
6866 private static final String COOKIE = "BIGipServerpool_sonarqube.example.com_8443=123456789.12345.0000" ;
6967
70- private final Logger logger = mock (Logger .class );
7168 private final Map <String , String > bootstrapProperties = new HashMap <>();
7269
7370 @ TempDir
@@ -84,15 +81,15 @@ void prepareMocks() {
8481 void support_custom_timeouts () {
8582 int readTimeoutSec = 2000 ;
8683
87- OkHttpClient underTest = OkHttpClientFactory .create (logger , Map .of (SONAR_WS_TIMEOUT , String .valueOf (readTimeoutSec )), sonarUserHome );
84+ OkHttpClient underTest = OkHttpClientFactory .create (Map .of (SONAR_WS_TIMEOUT , String .valueOf (readTimeoutSec )), sonarUserHome );
8885
8986 assertThat (underTest .readTimeoutMillis ()).isEqualTo (readTimeoutSec * 1000 );
9087 }
9188
9289 @ Test
9390 void support_custom_timeouts_throws_exception_on_non_number () {
9491 var props = Map .of (SONAR_WS_TIMEOUT , "fail" );
95- assertThatThrownBy (() -> OkHttpClientFactory .create (logger , props , sonarUserHome ))
92+ assertThatThrownBy (() -> OkHttpClientFactory .create (props , sonarUserHome ))
9693 .isInstanceOf (IllegalArgumentException .class )
9794 .hasMessage ("sonar.scanner.socketTimeout is not a valid integer: fail" );
9895 }
@@ -185,7 +182,7 @@ void it_should_throw_if_invalid_proxy_port() {
185182 bootstrapProperties .put ("sonar.scanner.proxyHost" , "localhost" );
186183 bootstrapProperties .put ("sonar.scanner.proxyPort" , "not_a_number" );
187184
188- assertThrows (IllegalArgumentException .class , () -> OkHttpClientFactory .create (logger , bootstrapProperties , sonarUserHome ));
185+ assertThrows (IllegalArgumentException .class , () -> OkHttpClientFactory .create (bootstrapProperties , sonarUserHome ));
189186 }
190187
191188 @ Nested
@@ -398,7 +395,7 @@ void it_should_support_jvm_system_properties() throws IOException {
398395 }
399396
400397 private Response call (String url ) throws IOException {
401- return OkHttpClientFactory .create (logger , bootstrapProperties , sonarUserHome ).newCall (
398+ return OkHttpClientFactory .create (bootstrapProperties , sonarUserHome ).newCall (
402399 new Request .Builder ()
403400 .url (url )
404401 .get ()
0 commit comments