From 9effe1630d97039b3e01cd9b58ed07e75be1d63c Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Mon, 25 Feb 2013 08:40:30 -0500 Subject: [PATCH] Merge pull request #75 from thefake/master --- tests/com/gitblit/tests/MarkdownUtilsTest.java | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/com/gitblit/tests/MarkdownUtilsTest.java b/tests/com/gitblit/tests/MarkdownUtilsTest.java index 2034bda..cd7ca02 100644 --- a/tests/com/gitblit/tests/MarkdownUtilsTest.java +++ b/tests/com/gitblit/tests/MarkdownUtilsTest.java @@ -15,17 +15,35 @@ */ package com.gitblit.tests; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.text.ParseException; -import junit.framework.TestCase; +import org.junit.Test; import com.gitblit.utils.MarkdownUtils; -public class MarkdownUtilsTest extends TestCase { +public class MarkdownUtilsTest { + @Test public void testMarkdown() throws Exception { - assertTrue(MarkdownUtils.transformMarkdown("# H1").equals("<h1> H1</h1>")); - assertTrue(MarkdownUtils.transformMarkdown("## H2").equals("<h2> H2</h2>")); + assertEquals("<h1> H1</h1>", MarkdownUtils.transformMarkdown("# H1")); + assertEquals("<h2> H2</h2>", MarkdownUtils.transformMarkdown("## H2")); + assertEquals("<p><strong>THIS</strong> is a test</p>", + MarkdownUtils.transformMarkdown("**THIS** is a test")); + assertEquals("<p>** THIS ** is a test</p>", + MarkdownUtils.transformMarkdown("** THIS ** is a test")); + assertEquals("<p>**THIS ** is a test</p>", + MarkdownUtils.transformMarkdown("**THIS ** is a test")); + assertEquals("<p>** THIS** is a test</p>", + MarkdownUtils.transformMarkdown("** THIS** is a test")); + + assertEquals("<table><tr><td>test</td></tr></table>", + MarkdownUtils.transformMarkdown("<table><tr><td>test</td></tr></table>")); + assertEquals("<table><tr><td><test></td></tr></table>", + MarkdownUtils.transformMarkdown("<table><tr><td><test></td></tr></table>")); + try { MarkdownUtils.transformMarkdown((String) null); assertTrue(false); -- Gitblit v1.9.1