void () { String spaceSeparator = " "; //noinspection rawtypes List split1 = StringUtil.split("test", spaceSeparator, false, false); List split2 = StringUtil.split(new CharSequenceSubSequence("test"), spaceSeparator, false, false); assertTrue(ContainerUtil.getOnlyItem(split1) instanceof String); assertTrue(ContainerUtil.getOnlyItem(split2) instanceof CharSequenceSubSequence); assertEquals(Arrays.asList(""), StringUtil.split("", spaceSeparator, false, false)); assertEquals(Arrays.asList(), StringUtil.split("", spaceSeparator, true, true)); assertEquals(Arrays.asList(" ", ""), StringUtil.split(" ", spaceSeparator, false, false)); assertEquals(Arrays.asList("", ""), StringUtil.split(" ", spaceSeparator, true, false)); assertEquals(Arrays.asList(), StringUtil.split(" ", spaceSeparator, true, true)); assertEquals(Arrays.asList("a", "b"), StringUtil.split("a b ", spaceSeparator, true, true)); assertEquals(Arrays.asList("a ", " ", "b "), StringUtil.split("a b ", spaceSeparator, false, true)); assertEquals(Arrays.asList("a ", " ", "b ", ""), StringUtil.split("a b ", spaceSeparator, false, false)); assertEquals(Arrays.asList("a", "b"), StringUtil.split("a b", spaceSeparator, true, true)); assertEquals(Arrays.asList("a ", " ", "b"), StringUtil.split("a b", spaceSeparator, false, true)); assertEquals(Arrays.asList("a ", " ", "b"), StringUtil.split("a b", spaceSeparator, false, false)); assertEquals(Arrays.asList("test"), StringUtil.split("test", spaceSeparator, true, true)); assertEquals(Arrays.asList("test"), StringUtil.split("test", spaceSeparator, false, true)); assertEquals(Arrays.asList("test"), StringUtil.split("test", spaceSeparator, true, false)); assertEquals(Arrays.asList("test"), StringUtil.split("test", spaceSeparator, false, false)); assertEquals(Arrays.asList("a", " b"), StringUtil.split("a b ", spaceSeparator, true, true)); assertEquals(Arrays.asList("a", "\n\tb"), StringUtil.split("a \n\tb ", spaceSeparator, true, true)); assertEquals(Arrays.asList("a\u00A0b"), StringUtil.split("a\u00A0b", spaceSeparator, true, true)); assertEquals(Arrays.asList(" \n\t", " "), StringUtil.split("a \n\ta ", "a", true, true)); }