diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-12-17 22:46:26 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-12-17 22:46:26 +0100 |
commit | 5afa530a10f6a22a8c1e656af0ca38e26207fa95 (patch) | |
tree | 0af640dca06398e6febf2f6705c7e5547eb09e55 /sonar-markdown/src | |
parent | cf10ce72b921014b5c867e0a2ddad30dc7aaf0f2 (diff) | |
download | sonarqube-5afa530a10f6a22a8c1e656af0ca38e26207fa95.tar.gz sonarqube-5afa530a10f6a22a8c1e656af0ca38e26207fa95.zip |
Move sonar-markdown to fest-assert
Diffstat (limited to 'sonar-markdown/src')
-rw-r--r-- | sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java index ad9858f3483..5bcf852daab 100644 --- a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java +++ b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java @@ -19,66 +19,65 @@ */ package org.sonar.markdown; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - import org.junit.Test; +import static org.fest.assertions.Assertions.assertThat; + 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>")); + assertThat(Markdown.convertToHtml("http://google.com")) + .isEqualTo("<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/>")); + assertThat(Markdown.convertToHtml("1\r2\r\n3\n")).isEqualTo("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>")); + assertThat(Markdown.convertToHtml(" * one\r* two\r\n* three\n * \n *five")) + .isEqualTo("<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")).isEqualTo("<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")); + assertThat(Markdown.convertToHtml("This is a ``line of code``")).isEqualTo("This is a <code>line of code</code>"); + assertThat(Markdown.convertToHtml("This is not a ``line of code")).isEqualTo("This is not a ``line of code"); } @Test public void shouldDecorateMultipleLineCode() { - assertThat(Markdown.convertToHtml("This is a ``\nline of code\nOn multiple lines\n``"), is("This is a <pre><code>line of code\nOn multiple lines</code></pre>")); - assertThat(Markdown.convertToHtml("This is not a ``line of code\nOn multiple lines``"), is("This is not a ``line of code<br/>On multiple lines``")); - assertThat(Markdown.convertToHtml("This is not a ``line of code\nOn multiple lines"), is("This is not a ``line of code<br/>On multiple lines")); + assertThat(Markdown.convertToHtml("This is a ``\nline of code\nOn multiple lines\n``")).isEqualTo("This is a <pre><code>line of code\nOn multiple lines</code></pre>"); + assertThat(Markdown.convertToHtml("This is not a ``line of code\nOn multiple lines``")).isEqualTo("This is not a ``line of code<br/>On multiple lines``"); + assertThat(Markdown.convertToHtml("This is not a ``line of code\nOn multiple lines")).isEqualTo("This is not a ``line of code<br/>On multiple lines"); } @Test public void shouldDecorateMultipleLineCodeWithLanguageSpecified() { - assertThat(Markdown.convertToHtml("This is a ``java\nline of code\nOn multiple lines\n``"), is("This is a <pre lang=\"java\"><code>line of code\nOn multiple lines</code></pre>")); - assertThat(Markdown.convertToHtml("This is not a ``java line of code\nOn multiple lines``"), is("This is not a ``java line of code<br/>On multiple lines``")); - assertThat(Markdown.convertToHtml("This is not a ``java \nline of code\nOn multiple lines``"), is("This is not a ``java <br/>line of code<br/>On multiple lines``")); + assertThat(Markdown.convertToHtml("This is a ``java\nline of code\nOn multiple lines\n``")).isEqualTo("This is a <pre lang=\"java\"><code>line of code\nOn multiple lines</code></pre>"); + assertThat(Markdown.convertToHtml("This is not a ``java line of code\nOn multiple lines``")).isEqualTo("This is not a ``java line of code<br/>On multiple lines``"); + assertThat(Markdown.convertToHtml("This is not a ``java \nline of code\nOn multiple lines``")).isEqualTo("This is not a ``java <br/>line of code<br/>On multiple lines``"); } @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>")); + assertThat(Markdown.convertToHtml("This is *important*")).isEqualTo("This is <em>important</em>"); + assertThat(Markdown.convertToHtml("This should not be * \n emphase")).isEqualTo("This should not be * <br/> emphase"); + assertThat(Markdown.convertToHtml("This is *very* very *important*")).isEqualTo("This is <em>very</em> very <em>important</em>"); + assertThat(Markdown.convertToHtml("Not * emphase * because of whitespaces")).isEqualTo("Not * emphase * because of whitespaces"); + assertThat(Markdown.convertToHtml("Not *emphase * because of whitespace")).isEqualTo("Not *emphase * because of whitespace"); + assertThat(Markdown.convertToHtml("Not * emphase* because of whitespace")).isEqualTo("Not * emphase* because of whitespace"); + assertThat(Markdown.convertToHtml("emphase*inside*word")).isEqualTo("emphase<em>inside</em>word"); + assertThat(Markdown.convertToHtml("*Emphase many words*")).isEqualTo("<em>Emphase many words</em>"); } @Test public void shouldNotChangeAnythingInTheText() { - assertThat(Markdown.convertToHtml("My text is $123 ''"), is("My text is $123 ''")); + assertThat(Markdown.convertToHtml("My text is $123 ''")).isEqualTo("My text is $123 ''"); } } |