From 84828a88e063c70deb4f4a8201b5a18f7334c6b2 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 3 Oct 2017 14:45:36 +0200 Subject: [PATCH] Fix build error with Maven 3.2.5 For unknown reasons HttpConnectorTest does not fail on Maven 3.3+ whereas a required dependency on commons-codec is missing. --- .../test/java/org/sonarqube/ws/client/HttpConnectorTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 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 f4d0f2a7521..97d963d1be4 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 @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Proxy; +import java.util.Base64; import java.util.List; import java.util.Random; import javax.net.ssl.SSLSocketFactory; @@ -30,7 +31,6 @@ import okhttp3.ConnectionSpec; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.RandomStringUtils; @@ -185,7 +185,8 @@ public class HttpConnectorTest { RecordedRequest recordedRequest = server.takeRequest(); // do not use OkHttp Credentials.basic() in order to not use the same code as the code under test - String expectedHeader = "Basic " + Base64.encodeBase64String((login + ":" + password).getBytes(UTF_8)); + + String expectedHeader = "Basic " + Base64.getEncoder().encodeToString((login + ":" + password).getBytes(UTF_8)); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo(expectedHeader); } -- 2.39.5