From 38b3cc5a1332ad9871c4f7f189a23724d774a1ea Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Thu, 5 May 2011 15:19:52 +0200 Subject: Rename the class MarkdownEngine to Markdown --- .../org/sonar/markdown/MarkdownEngineTest.java | 70 ---------------------- .../test/java/org/sonar/markdown/MarkdownTest.java | 70 ++++++++++++++++++++++ 2 files changed, 70 insertions(+), 70 deletions(-) delete mode 100644 sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java create mode 100644 sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java (limited to 'sonar-markdown/src/test/java') diff --git a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java deleted file mode 100644 index b1979254828..00000000000 --- a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.markdown; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -import org.junit.Test; - -public class MarkdownEngineTest { - - @Test - public void shouldDecorateUrl() { - assertThat(MarkdownEngine.convertToHtml("http://google.com"), - is("http://google.com")); - } - - @Test - public void shouldDecorateEndOfLine() { - assertThat(MarkdownEngine.convertToHtml("1\r2\r\n3\n"), is("1
2
3
")); - } - - @Test - public void shouldDecorateList() { - assertThat(MarkdownEngine.convertToHtml(" * one\r* two\r\n* three\n * \n *five"), - is(" *five")); - assertThat(MarkdownEngine.convertToHtml(" * one\r* two"), is("")); - } - - @Test - public void shouldDecorateCode() { - assertThat(MarkdownEngine.convertToHtml("This is a ``line of code``"), is("This is a line of code")); - assertThat(MarkdownEngine.convertToHtml("This is not a ``line of code"), is("This is not a ``line of code")); - } - - @Test - public void shouldEmphaseText() { - assertThat(MarkdownEngine.convertToHtml("This is *important*"), is("This is important")); - assertThat(MarkdownEngine.convertToHtml("This should not be * \n emphase"), is("This should not be *
emphase")); - assertThat(MarkdownEngine.convertToHtml("This is *very* very *important*"), is("This is very very important")); - assertThat(MarkdownEngine.convertToHtml("Not * emphase * because of whitespaces"), is("Not * emphase * because of whitespaces")); - assertThat(MarkdownEngine.convertToHtml("Not *emphase * because of whitespace"), is("Not *emphase * because of whitespace")); - assertThat(MarkdownEngine.convertToHtml("Not * emphase* because of whitespace"), is("Not * emphase* because of whitespace")); - assertThat(MarkdownEngine.convertToHtml("emphase*inside*word"), is("emphaseinsideword")); - assertThat(MarkdownEngine.convertToHtml("*Emphase many words*"), is("Emphase many words")); - } - - @Test - public void shouldNotChangeAnythingInTheText() { - assertThat(MarkdownEngine.convertToHtml("My text is $123 ''"), is("My text is $123 ''")); - } - -} diff --git a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java new file mode 100644 index 00000000000..095263734db --- /dev/null +++ b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java @@ -0,0 +1,70 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.markdown; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +import org.junit.Test; + +public class MarkdownTest { + + @Test + public void shouldDecorateUrl() { + assertThat(Markdown.convertToHtml("http://google.com"), + is("http://google.com")); + } + + @Test + public void shouldDecorateEndOfLine() { + assertThat(Markdown.convertToHtml("1\r2\r\n3\n"), is("1
2
3
")); + } + + @Test + public void shouldDecorateList() { + assertThat(Markdown.convertToHtml(" * one\r* two\r\n* three\n * \n *five"), + is(" *five")); + assertThat(Markdown.convertToHtml(" * one\r* two"), is("")); + } + + @Test + public void shouldDecorateCode() { + assertThat(Markdown.convertToHtml("This is a ``line of code``"), is("This is a line of code")); + assertThat(Markdown.convertToHtml("This is not a ``line of code"), is("This is not a ``line of code")); + } + + @Test + public void shouldEmphaseText() { + assertThat(Markdown.convertToHtml("This is *important*"), is("This is important")); + assertThat(Markdown.convertToHtml("This should not be * \n emphase"), is("This should not be *
emphase")); + assertThat(Markdown.convertToHtml("This is *very* very *important*"), is("This is very very important")); + assertThat(Markdown.convertToHtml("Not * emphase * because of whitespaces"), is("Not * emphase * because of whitespaces")); + assertThat(Markdown.convertToHtml("Not *emphase * because of whitespace"), is("Not *emphase * because of whitespace")); + assertThat(Markdown.convertToHtml("Not * emphase* because of whitespace"), is("Not * emphase* because of whitespace")); + assertThat(Markdown.convertToHtml("emphase*inside*word"), is("emphaseinsideword")); + assertThat(Markdown.convertToHtml("*Emphase many words*"), is("Emphase many words")); + } + + @Test + public void shouldNotChangeAnythingInTheText() { + assertThat(Markdown.convertToHtml("My text is $123 ''"), is("My text is $123 ''")); + } + +} -- cgit v1.2.3