MarkdownUtil { public static void generateLists(@NotNull List<String> lines) { new ListItemProcessor(lines).process(); } private  MarkdownUtil(); static void replaceHeaders(@NotNull List<String> lines); static void removeImages(@NotNull List<String> lines); static void replaceCodeBlock(@NotNull List<String> lines); static void generateLists(@NotNull List<String> lines);  }
@Test public void testReplaceLists1() throws Exception { List<String> markdown = Arrays.asList( "* Red", "* Green", "* Blue" ); MarkdownUtil.generateLists(markdown); Assert.assertEquals( Arrays.asList( "<ul><li>Red</li>", "<li>Green</li>", "<li>Blue</li></ul>" ), markdown ); }
@Test public void testReplaceLists2() throws Exception { List<String> markdown = Arrays.asList( "1. Red", "", "2. Blue" ); MarkdownUtil.generateLists(markdown); Assert.assertEquals( Arrays.asList( "<ol><li>Red</li>", "", "<li>Blue</li></ol>" ), markdown ); }
@Test public void testReplaceLists3() throws Exception { List<String> markdown = Arrays.asList( "1986\\. What a great season." ); MarkdownUtil.generateLists(markdown); Assert.assertEquals( Arrays.asList( "1986\\. What a great season." ), markdown ); }
@Test public void testReplaceLists4() throws Exception { List<String> markdown = Arrays.asList( "+ one two", "three", "", " four", "+ five", "six", "", "seven", "", "+ eight" ); MarkdownUtil.generateLists(markdown); Assert.assertEquals( Arrays.asList( "<ul><li>one two", "three", "", "four</li>", "<li>five", "six</li></ul>", "", "seven", "", "<ul><li>eight</li></ul>" ), markdown ); }