|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+import org.junit.Before;
|
|
|
2
|
+import org.junit.Ignore;
|
|
|
3
|
+import org.junit.Test;
|
|
|
4
|
+
|
|
|
5
|
+import static org.junit.Assert.assertEquals;
|
|
|
6
|
+
|
|
|
7
|
+public class MarkdownTest {
|
|
|
8
|
+
|
|
|
9
|
+ private Markdown markdown;
|
|
|
10
|
+
|
|
|
11
|
+ @Before
|
|
|
12
|
+ public void setup() {
|
|
|
13
|
+ markdown = new Markdown();
|
|
|
14
|
+ }
|
|
|
15
|
+
|
|
|
16
|
+ @Test
|
|
|
17
|
+ public void normalTextAsAParagraph() {
|
|
|
18
|
+ String input = "This will be a paragraph";
|
|
|
19
|
+ String expected = "<p>This will be a paragraph</p>";
|
|
|
20
|
+
|
|
|
21
|
+ assertEquals(expected, markdown.parse(input));
|
|
|
22
|
+ }
|
|
|
23
|
+
|
|
|
24
|
+ @Ignore("Remove to run test")
|
|
|
25
|
+ @Test
|
|
|
26
|
+ public void italics() {
|
|
|
27
|
+ String input = "_This will be italic_";
|
|
|
28
|
+ String expected = "<p><em>This will be italic</em></p>";
|
|
|
29
|
+
|
|
|
30
|
+ assertEquals(expected, markdown.parse(input));
|
|
|
31
|
+ }
|
|
|
32
|
+
|
|
|
33
|
+ @Ignore("Remove to run test")
|
|
|
34
|
+ @Test
|
|
|
35
|
+ public void boldText() {
|
|
|
36
|
+ String input = "__This will be bold__";
|
|
|
37
|
+ String expected = "<p><strong>This will be bold</strong></p>";
|
|
|
38
|
+
|
|
|
39
|
+ assertEquals(expected, markdown.parse(input));
|
|
|
40
|
+ }
|
|
|
41
|
+
|
|
|
42
|
+ @Ignore("Remove to run test")
|
|
|
43
|
+ @Test
|
|
|
44
|
+ public void normalItalicsAndBoldText() {
|
|
|
45
|
+ String input = "This will _be_ __mixed__";
|
|
|
46
|
+ String expected = "<p>This will <em>be</em> <strong>mixed</strong></p>";
|
|
|
47
|
+
|
|
|
48
|
+ assertEquals(expected, markdown.parse(input) );
|
|
|
49
|
+ }
|
|
|
50
|
+
|
|
|
51
|
+ @Ignore("Remove to run test")
|
|
|
52
|
+ @Test
|
|
|
53
|
+ public void withH1HeaderLevel() {
|
|
|
54
|
+ String input = "# This will be an h1";
|
|
|
55
|
+ String expected = "<h1>This will be an h1</h1>";
|
|
|
56
|
+
|
|
|
57
|
+ assertEquals(expected, markdown.parse(input) );
|
|
|
58
|
+ }
|
|
|
59
|
+
|
|
|
60
|
+ @Ignore("Remove to run test")
|
|
|
61
|
+ @Test
|
|
|
62
|
+ public void withH2HeaderLevel() {
|
|
|
63
|
+ String input = "## This will be an h2";
|
|
|
64
|
+ String expected = "<h2>This will be an h2</h2>";
|
|
|
65
|
+
|
|
|
66
|
+ assertEquals(expected, markdown.parse(input) );
|
|
|
67
|
+ }
|
|
|
68
|
+
|
|
|
69
|
+ @Ignore("Remove to run test")
|
|
|
70
|
+ @Test
|
|
|
71
|
+ public void withH6HeaderLevel() {
|
|
|
72
|
+ String input = "###### This will be an h6";
|
|
|
73
|
+ String expected = "<h6>This will be an h6</h6>";
|
|
|
74
|
+
|
|
|
75
|
+ assertEquals(expected, markdown.parse(input) );
|
|
|
76
|
+ }
|
|
|
77
|
+
|
|
|
78
|
+ @Ignore("Remove to run test")
|
|
|
79
|
+ @Test
|
|
|
80
|
+ public void unorderedLists() {
|
|
|
81
|
+ String input = "* Item 1\n* Item 2";
|
|
|
82
|
+ String expected = "<ul><li>Item 1</li><li>Item 2</li></ul>";
|
|
|
83
|
+
|
|
|
84
|
+ assertEquals(expected, markdown.parse(input) );
|
|
|
85
|
+ }
|
|
|
86
|
+
|
|
|
87
|
+ @Ignore("Remove to run test")
|
|
|
88
|
+ @Test
|
|
|
89
|
+ public void aLittleBitOfEverything() {
|
|
|
90
|
+ String input = "# Header!\n* __Bold Item__\n* _Italic Item_";
|
|
|
91
|
+ String expected = "<h1>Header!</h1><ul><li><strong>Bold Item</strong></li><li><em>Italic Item</em></li></ul>";
|
|
|
92
|
+
|
|
|
93
|
+ assertEquals(expected, markdown.parse(input) );
|
|
|
94
|
+ }
|
|
|
95
|
+}
|