From cd0a957de6c4f0588f64e2724988f6a4007a9443 Mon Sep 17 00:00:00 2001 From: Kateryna Oblakevych Date: Fri, 5 Jan 2024 04:39:01 +0200 Subject: [PATCH] remove unixPath changes --- src/main/java/com/crowdin/cli/utils/Utils.java | 7 +------ src/test/java/com/crowdin/cli/utils/UtilsTest.java | 13 ++----------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/crowdin/cli/utils/Utils.java b/src/main/java/com/crowdin/cli/utils/Utils.java index e84237b97..293c46373 100755 --- a/src/main/java/com/crowdin/cli/utils/Utils.java +++ b/src/main/java/com/crowdin/cli/utils/Utils.java @@ -87,12 +87,7 @@ public static String buildUserAgent() { } public static String unixPath(String path) { - if (path == null) { - return null; - } - return isWindows() - ? path.replaceAll("[\\\\/]+", "/") - : path.replaceAll("\\\\{2,}", "/").replaceAll("/+", "/"); + return (path != null) ? path.replaceAll("\\{2,}", "/").replaceAll("/+", "/") : null; } public static String windowsPath(String path) { diff --git a/src/test/java/com/crowdin/cli/utils/UtilsTest.java b/src/test/java/com/crowdin/cli/utils/UtilsTest.java index 732a0a59b..c909068d7 100644 --- a/src/test/java/com/crowdin/cli/utils/UtilsTest.java +++ b/src/test/java/com/crowdin/cli/utils/UtilsTest.java @@ -3,8 +3,6 @@ import java.util.Optional; import org.apache.commons.lang3.SystemUtils; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnOs; -import org.junit.jupiter.api.condition.OS; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -38,15 +36,8 @@ public void testBuildUserAgent() { } @Test - @DisabledOnOs({OS.LINUX, OS.MAC}) - public void testUnixPath_windows() { - assertEquals("/path/to/file", Utils.unixPath("\\path\\to\\\\file")); - } - - @Test - @DisabledOnOs(OS.WINDOWS) - public void testUnixPath_unix() { - assertEquals("/path/to/file", Utils.unixPath("/path/to\\\\file")); + public void testUnixPath() { + assertEquals("/path/to/file", Utils.unixPath("\\path\\to\\file")); } @Test