diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-05-05 15:19:52 +0200 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-05-05 15:28:58 +0200 |
commit | 38b3cc5a1332ad9871c4f7f189a23724d774a1ea (patch) | |
tree | 3f10b42c9ea734570e26899bc8d8e2316bcbe9a1 /sonar-markdown | |
parent | c72a3de1c77a89ec1671233cfd5debbf50881ff6 (diff) | |
download | sonarqube-38b3cc5a1332ad9871c4f7f189a23724d774a1ea.tar.gz sonarqube-38b3cc5a1332ad9871c4f7f189a23724d774a1ea.zip |
Rename the class MarkdownEngine to Markdown
Diffstat (limited to 'sonar-markdown')
-rw-r--r-- | sonar-markdown/src/main/java/org/sonar/markdown/Markdown.java (renamed from sonar-markdown/src/main/java/org/sonar/markdown/MarkdownEngine.java) | 6 | ||||
-rw-r--r-- | sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java | 70 | ||||
-rw-r--r-- | sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java | 70 |
3 files changed, 73 insertions, 73 deletions
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownEngine.java b/sonar-markdown/src/main/java/org/sonar/markdown/Markdown.java index 13c80ce39ff..9e7522cd692 100644 --- a/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownEngine.java +++ b/sonar-markdown/src/main/java/org/sonar/markdown/Markdown.java @@ -29,11 +29,11 @@ import java.util.List; /** * Entry point of the Markdown library */ -public final class MarkdownEngine { +public final class Markdown { private ChannelDispatcher<MarkdownOutput> dispatcher; - private MarkdownEngine() { + private Markdown() { List<Channel> markdownChannels = Arrays.<Channel>asList( new HtmlUrlChannel(), new HtmlEndOfLineChannel(), @@ -58,6 +58,6 @@ public final class MarkdownEngine { } public static String convertToHtml(String input) { - return new MarkdownEngine().convert(input); + return new Markdown().convert(input); } } 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("<a href=\"http://google.com\" target=\"_blank\">http://google.com</a>")); - } - - @Test - public void shouldDecorateEndOfLine() { - assertThat(MarkdownEngine.convertToHtml("1\r2\r\n3\n"), is("1<br/>2<br/>3<br/>")); - } - - @Test - public void shouldDecorateList() { - assertThat(MarkdownEngine.convertToHtml(" * one\r* two\r\n* three\n * \n *five"), - is("<ul><li>one</li>\r<li>two</li>\r\n<li>three</li>\n<li> </li>\n</ul> *five")); - assertThat(MarkdownEngine.convertToHtml(" * one\r* two"), is("<ul><li>one</li>\r<li>two</li></ul>")); - } - - @Test - public void shouldDecorateCode() { - assertThat(MarkdownEngine.convertToHtml("This is a ``line of code``"), is("This is a <code>line of code</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 <em>important</em>")); - assertThat(MarkdownEngine.convertToHtml("This should not be * \n emphase"), is("This should not be * <br/> emphase")); - assertThat(MarkdownEngine.convertToHtml("This is *very* very *important*"), is("This is <em>very</em> very <em>important</em>")); - 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("emphase<em>inside</em>word")); - assertThat(MarkdownEngine.convertToHtml("*Emphase many words*"), is("<em>Emphase many words</em>")); - } - - @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("<a href=\"http://google.com\" target=\"_blank\">http://google.com</a>")); + } + + @Test + public void shouldDecorateEndOfLine() { + assertThat(Markdown.convertToHtml("1\r2\r\n3\n"), is("1<br/>2<br/>3<br/>")); + } + + @Test + public void shouldDecorateList() { + assertThat(Markdown.convertToHtml(" * one\r* two\r\n* three\n * \n *five"), + is("<ul><li>one</li>\r<li>two</li>\r\n<li>three</li>\n<li> </li>\n</ul> *five")); + assertThat(Markdown.convertToHtml(" * one\r* two"), is("<ul><li>one</li>\r<li>two</li></ul>")); + } + + @Test + public void shouldDecorateCode() { + assertThat(Markdown.convertToHtml("This is a ``line of code``"), is("This is a <code>line of code</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 <em>important</em>")); + assertThat(Markdown.convertToHtml("This should not be * \n emphase"), is("This should not be * <br/> emphase")); + assertThat(Markdown.convertToHtml("This is *very* very *important*"), is("This is <em>very</em> very <em>important</em>")); + 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("emphase<em>inside</em>word")); + assertThat(Markdown.convertToHtml("*Emphase many words*"), is("<em>Emphase many words</em>")); + } + + @Test + public void shouldNotChangeAnythingInTheText() { + assertThat(Markdown.convertToHtml("My text is $123 ''"), is("My text is $123 ''")); + } + +} |