diff --git a/src/main/java/com/xyz/caofancpu/d8ger/util/VerbalExpressionUtil.java b/src/main/java/com/xyz/caofancpu/d8ger/util/VerbalExpressionUtil.java index c2bf268..bf4d914 100644 --- a/src/main/java/com/xyz/caofancpu/d8ger/util/VerbalExpressionUtil.java +++ b/src/main/java/com/xyz/caofancpu/d8ger/util/VerbalExpressionUtil.java @@ -24,7 +24,7 @@ public class VerbalExpressionUtil { /** * Judge current system is WINDOWS, by the way, WINDOWS is real ***... */ - public static boolean CURRENT_OS_IS_WINDOWS = Objects.equals(System.getProperty("os.name").toLowerCase(), "windows"); + public static final boolean CURRENT_OS_IS_WINDOWS = Objects.equals(System.getProperty("os.name").toLowerCase(), "windows"); /** * Uppercase regular expression diff --git a/src/test/java/d8ger/D8T.java b/src/test/java/d8ger/D8T.java index 736506f..0f271cc 100644 --- a/src/test/java/d8ger/D8T.java +++ b/src/test/java/d8ger/D8T.java @@ -1,11 +1,7 @@ package d8ger; -import com.google.common.collect.Lists; -import com.xyz.caofancpu.d8ger.util.VerbalExpressionUtil; import org.junit.Test; -import java.util.List; - /** * This is a Test Demo showing how to execute a test case by junit. * @@ -16,39 +12,7 @@ public class D8T { @Test public void hello() { - String nonW = "/myProject/common/src/main/java/com/cy/common/model/Student"; - String nonW1 = "myProject/common/src/main/java/com/cy/common/model/Student"; - String w1 = "D:/myProject/common/src/main/java/com/cy/common/model/Student"; - String w11 = "D://myProject//common//src//main//java//com//cy//common//model//Student"; - String w121 = "D:"; - String w122 = "D:/"; - String w123 = "D://"; - String w124 = "D:\\"; - String w125 = "D:\\\\"; - String w2 = "D:\\myProject\\common\\src\\main\\java\\com\\cy\\common\\model\\Student"; - String w3 = "D:\\\\myProject\\\\common\\\\src\\\\main\\\\java\\\\com\\\\cy\\\\common\\\\model\\\\Student"; - List nonWindowsSourceList = Lists.newArrayList(nonW, nonW1); - // - List windowsSourceList = Lists.newArrayList(w1, w11, w2, w3, w121, w122, w123, w124, w125); - System.out.println("非Windows系统:"); - for (String s : nonWindowsSourceList) { - try { - System.out.println(" 原串 " + s + " 处理后变为 " + VerbalExpressionUtil.convertPathToPackage(s) + " "); - System.out.println(" 原串2 " + s + " 处理后变为 " + VerbalExpressionUtil.convertPathToPackage2(s) + " "); - } catch (Exception e) { - e.printStackTrace(); - } - } - System.out.println("Windows系统:"); - VerbalExpressionUtil.CURRENT_OS_IS_WINDOWS = Boolean.TRUE; - for (String s : windowsSourceList) { - try { - System.out.println(" 原串 " + s + " 处理后变为 " + VerbalExpressionUtil.convertPathToPackage(s) + " "); - System.out.println(" 原串2 " + s + " 处理后变为 " + VerbalExpressionUtil.convertPathToPackage2(s) + " "); - } catch (Exception e) { - e.printStackTrace(); - } - } + } }