This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a8efaa67d add unit test for StringFunctions encodeUrl (#13391)
0a8efaa67d is described below

commit 0a8efaa67d2fd88243a5779754205fb656dee205
Author: sullis <git...@seansullivan.com>
AuthorDate: Fri Jun 14 01:18:13 2024 -0700

    add unit test for StringFunctions encodeUrl (#13391)
---
 .../function/scalar/StringFunctionsTest.java       | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git 
a/pinot-common/src/test/java/org/apache/pinot/common/function/scalar/StringFunctionsTest.java
 
b/pinot-common/src/test/java/org/apache/pinot/common/function/scalar/StringFunctionsTest.java
index 6c9fa465f5..3a61e414df 100644
--- 
a/pinot-common/src/test/java/org/apache/pinot/common/function/scalar/StringFunctionsTest.java
+++ 
b/pinot-common/src/test/java/org/apache/pinot/common/function/scalar/StringFunctionsTest.java
@@ -138,4 +138,29 @@ public class StringFunctionsTest {
     assertEquals(StringFunctions.uniqueNgrams(input, maxGram), 
expectedExactNGram);
     assertEquals(StringFunctions.uniqueNgrams(input, minGram, maxGram), 
expectedNGram);
   }
+
+  @Test
+  public void encodeUrl() {
+    assertEquals(StringFunctions.encodeUrl(""), "");
+    assertEquals(StringFunctions.encodeUrl("a"), "a");
+    assertEquals(StringFunctions.encodeUrl("A"), "A");
+    assertEquals(StringFunctions.encodeUrl(" "), "+");
+    assertEquals(StringFunctions.encodeUrl("?"), "%3F");
+    assertEquals(StringFunctions.encodeUrl("/"), "%2F");
+    assertEquals(StringFunctions.encodeUrl("&"), "%26");
+    assertEquals(StringFunctions.encodeUrl(":"), "%3A");
+    assertEquals(StringFunctions.encodeUrl("="), "%3D");
+    assertEquals(StringFunctions.encodeUrl("@"), "%40");
+
+    assertEquals(StringFunctions.encodeUrl(
+        "http://localhost:8080/hello?a=b";), 
"http%3A%2F%2Flocalhost%3A8080%2Fhello%3Fa%3Db");
+
+    // CHECKSTYLE:OFF
+    assertEquals(StringFunctions.encodeUrl(
+        "http://localhost:8080/hello?paramWithSpace=a b"), 
"http%3A%2F%2Flocalhost%3A8080%2Fhello%3FparamWithSpace%3Da+b");
+    // CHECKSTYLE:ON
+
+    assertEquals(StringFunctions.encodeUrl(
+        "https://localhost:8080/hello?a=b";), 
"https%3A%2F%2Flocalhost%3A8080%2Fhello%3Fa%3Db");
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to