diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2024-10-08 10:31:31 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-10-14 20:03:04 +0000 |
commit | 1e315cf59823550446594a03ca13a6b175341d80 (patch) | |
tree | 50f00f41249ae09f11f574c5a4e60ecc3f455586 /sonar-ws/src/test/java/org/sonarqube/ws/client | |
parent | 1ad3667d30dd82213ae47bea2c267188f003b2c7 (diff) | |
download | sonarqube-1e315cf59823550446594a03ca13a6b175341d80.tar.gz sonarqube-1e315cf59823550446594a03ca13a6b175341d80.zip |
NO-JIRA Remove new code issues resulting from the update of the deprecated methods.
Diffstat (limited to 'sonar-ws/src/test/java/org/sonarqube/ws/client')
-rw-r--r-- | sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java index 411dd9b9bbc..c0320cbde02 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java @@ -19,6 +19,9 @@ */ package org.sonarqube.ws.client; +import com.tngtech.java.junit.dataprovider.DataProvider; +import com.tngtech.java.junit.dataprovider.DataProviderRunner; +import com.tngtech.java.junit.dataprovider.UseDataProvider; import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; @@ -26,7 +29,6 @@ import java.net.Proxy; import java.net.SocketTimeoutException; import java.util.Base64; import java.util.List; -import java.util.Random; import java.util.concurrent.TimeUnit; import java.util.zip.GZIPOutputStream; import javax.net.ssl.SSLSocketFactory; @@ -45,6 +47,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; import org.sonarqube.ws.MediaTypes; import static java.nio.charset.StandardCharsets.UTF_8; @@ -56,6 +59,7 @@ import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.sonarqube.ws.client.HttpConnector.newBuilder; +@RunWith(DataProviderRunner.class) public class HttpConnectorTest { @Rule @@ -249,9 +253,9 @@ public class HttpConnectorTest { } @Test - public void systemPassCode_sets_header_when_value_is_not_null() throws InterruptedException { + @UseDataProvider("nonNullPasswords") + public void systemPassCode_sets_header_when_value_is_not_null(String systemPassCode) throws InterruptedException { answerHelloWorld(); - String systemPassCode = new Random().nextBoolean() ? "" : RandomStringUtils.secure().nextAlphanumeric(21); underTest = HttpConnector.newBuilder() .url(serverUrl) .systemPassCode(systemPassCode) @@ -557,6 +561,14 @@ public class HttpConnectorTest { assertThat(connectionSpecs.get(1).isTls()).isFalse(); } + @DataProvider() + public static Object[][] nonNullPasswords() { + return new Object[][] { + {""}, + {RandomStringUtils.secure().nextAlphanumeric(21)} + }; + } + private void answerHelloWorld() { server.enqueue(new MockResponse().setBody("hello, world!").setHeader("header", "value")); } |