forked from cse15lss122/markdown-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarkdownParseTest.java
82 lines (62 loc) · 2.53 KB
/
MarkdownParseTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import org.junit.Test;
public class MarkdownParseTest {
@Test
public void addition() {
assertEquals(2, 1 + 1);
}
@Test
public void testGetLinks() throws IOException{
//
ArrayList<String> correct = new ArrayList<>();
correct.add("https://something.com");
correct.add("some-thing.html"); //expected)
Path fileName = Path.of("/Users/Aisha/Documents/GitHub/markdown-parser-1/test-file.md");
String content = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(content); //actual
assertEquals(correct, links);
}
public void testGetLinks1() throws IOException {
Path fileName = Path.of("/Users/Aisha/Documents/GitHub/markdown-parser-1/test-file.md");
String content = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(content);
ArrayList<String> expected = new ArrayList<>();
expected.add("https://something.com");
expected.add("some-thing.html");
assertEquals(expected, links);
}
@Test
public void testGetLinks3() throws IOException {
Path fileName = Path.of("/Users/Aisha/Documents/GitHub/markdown-parser-1/test-file3.md");
String content = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(content);
ArrayList<String> expected = new ArrayList<>();
expected.add("more text here");
assertEquals(expected, links);
}
@Test
public void testGetLinks5() throws IOException {
Path fileName = Path.of("/Users/Aisha/Documents/GitHub/markdown-parser-1/test-file5.md");
String content = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(content);
ArrayList<String> expected = new ArrayList<>();
expected.add("page.com");
assertEquals(expected, links);
}
@Test
public void testGetLinks6() throws IOException {
Path fileName = Path.of("/Users/Aisha/Documents/GitHub/markdown-parser-1/test-file6.md");
String content = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(content);
ArrayList<String> expected = new ArrayList<>();
expected.add("page.com");
assertEquals(expected, links);
}
public static void main(String[] args) {
return;
}
}