SvgCssUtils { public static List<String> splitValueList(String value) { List<String> result = new ArrayList<>(); if (value != null && value.length() > 0) { value = value.trim(); String[] list = value.split("\\s*(,|\\s)\\s*"); result.addAll(Arrays.asList(list)); } return result; } private  SvgCssUtils(); static List<String> splitValueList(String value); static String convertFloatToString(float value); static String convertDoubleToString(double value); @Deprecated static float convertPtsToPx(float pts); @Deprecated static double convertPtsToPx(double pts); @Deprecated static boolean isStyleSheetLink(IElementNode headChildElement);  }
@Test public void commaSplitValueTest() { String input = "a,b,c,d"; List<String> expected = new ArrayList<>(); expected.add("a"); expected.add("b"); expected.add("c"); expected.add("d"); List<String> actual = SvgCssUtils.splitValueList(input); Assert.assertEquals(expected, actual); }
@Test public void leadingAndTrailingWhiteSpaceTest() { String input = " -140.465,-116.438 -163.725,-103.028 -259.805,-47.618 "; List<String> expected = new ArrayList<>(); expected.add("-140.465"); expected.add("-116.438"); expected.add("-163.725"); expected.add("-103.028"); expected.add("-259.805"); expected.add("-47.618"); List<String> actual = SvgCssUtils.splitValueList(input); Assert.assertEquals(expected, actual); }
@Test public void whitespaceSplitValueTest() { String input = "1 2 3 4"; List<String> expected = new ArrayList<>(); expected.add("1"); expected.add("2"); expected.add("3"); expected.add("4"); List<String> actual = SvgCssUtils.splitValueList(input); Assert.assertEquals(expected, actual); }
@Test public void newLineSplitValueTest() { String input = "1\n2\n3\n4"; List<String> expected = new ArrayList<>(); expected.add("1"); expected.add("2"); expected.add("3"); expected.add("4"); List<String> actual = SvgCssUtils.splitValueList(input); Assert.assertEquals(expected, actual); }
@Test public void tabSplitValueTest() { String input = "1\t2\t3\t4"; List<String> expected = new ArrayList<>(); expected.add("1"); expected.add("2"); expected.add("3"); expected.add("4"); List<String> actual = SvgCssUtils.splitValueList(input); Assert.assertEquals(expected, actual); }
@Test public void mixedCommaWhitespaceSplitValueTest() { String input = "1,2 a,b"; List<String> expected = new ArrayList<>(); expected.add("1"); expected.add("2"); expected.add("a"); expected.add("b"); List<String> actual = SvgCssUtils.splitValueList(input); Assert.assertEquals(expected, actual); }
@Test public void nullSplitValueTest() { List<String> actual = SvgCssUtils.splitValueList(null); Assert.assertTrue(actual.isEmpty()); }
@Test public void emptySplitValueTest() { List<String> actual = SvgCssUtils.splitValueList(""); Assert.assertTrue(actual.isEmpty()); }