Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Make cleanUrl non-static so that APIs can overwrite it #614

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ protected JSONObject loadJsonResource(String filename) {
* @param myURL the URL to clean
* @return cleaned URL
*/
public static String cleanUrl(String myURL) {
public String cleanUrl(String myURL) {
String[] parts = myURL.split("\\?");
String url = parts[0];
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.junit.Test;
import org.mockito.Mockito;

import java.util.Arrays;

Expand All @@ -12,10 +13,11 @@

public class ApacheBaseApiTest {
@Test
public void cleanUrlShouldHandleMultipleEqualsSigns() throws Exception {
public void cleanUrlShouldHandleMultipleEqualsSigns() {
BaseApi baseApi = Mockito.mock(BaseApi.class, Mockito.CALLS_REAL_METHODS);
String url = "http://www.example.com/file?param1=value=1&param=value2";
assertEquals("http://www.example.com/file?param1=value%3D1&param=value2",
ApacheBaseApi.cleanUrl(url));
baseApi.cleanUrl(url));
}

@Test
Expand Down