From 4c8535670c00116ce7c64f9b2555381b94b12cfc Mon Sep 17 00:00:00 2001 From: Googler Date: Fri, 31 Mar 2023 07:55:47 -0700 Subject: [PATCH] Fix ProxyHelperTest on JDK@HEAD PiperOrigin-RevId: 520922614 Change-Id: Idcfe6c038fe1340fe5fed2518ebf8d1bccaa0a3e --- .../bazel/repository/downloader/ProxyHelperTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/google/devtools/build/lib/bazel/repository/downloader/ProxyHelperTest.java b/src/test/java/com/google/devtools/build/lib/bazel/repository/downloader/ProxyHelperTest.java index 30a930ead7c924..23c9d5b4e43e9e 100644 --- a/src/test/java/com/google/devtools/build/lib/bazel/repository/downloader/ProxyHelperTest.java +++ b/src/test/java/com/google/devtools/build/lib/bazel/repository/downloader/ProxyHelperTest.java @@ -36,28 +36,28 @@ public class ProxyHelperTest { public void testCreateIfNeededHttpLowerCase() throws Exception { ProxyHelper helper = new ProxyHelper(ImmutableMap.of("http_proxy", "http://my.example.com")); Proxy proxy = helper.createProxyIfNeeded(new URL("http://www.something.com")); - assertThat(proxy.toString()).endsWith("my.example.com:80"); + assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/)?:80$"); } @Test public void testCreateIfNeededHttpUpperCase() throws Exception { ProxyHelper helper = new ProxyHelper(ImmutableMap.of("HTTP_PROXY", "http://my.example.com")); Proxy proxy = helper.createProxyIfNeeded(new URL("http://www.something.com")); - assertThat(proxy.toString()).endsWith("my.example.com:80"); + assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/)?:80$"); } @Test public void testCreateIfNeededHttpsLowerCase() throws Exception { ProxyHelper helper = new ProxyHelper(ImmutableMap.of("https_proxy", "https://my.example.com")); Proxy proxy = helper.createProxyIfNeeded(new URL("https://www.something.com")); - assertThat(proxy.toString()).endsWith("my.example.com:443"); + assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/)?:443$"); } @Test public void testCreateIfNeededHttpsUpperCase() throws Exception { ProxyHelper helper = new ProxyHelper(ImmutableMap.of("HTTPS_PROXY", "https://my.example.com")); Proxy proxy = helper.createProxyIfNeeded(new URL("https://www.something.com")); - assertThat(proxy.toString()).endsWith("my.example.com:443"); + assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/)?:443$"); } @Test @@ -141,7 +141,7 @@ public void testCreateIfNeededNoProxyNoMatchSubstring() throws Exception { "HTTPS_PROXY", "https://my.example.com")); Proxy proxy = helper.createProxyIfNeeded(new URL("https://www.not-example.com")); - assertThat(proxy.toString()).endsWith("my.example.com:443"); + assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/)?:443$"); } @Test