forked from bcli12/markdown-parse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MarkdownParseTest.java
88 lines (81 loc) · 2.86 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
83
84
85
86
87
88
import static org.junit.Assert.*;
import org.junit.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
public class MarkdownParseTest {
/*
@Test
public void addition() {
assertEquals(2, 1 + 1);
}
*/
@Test
public void tester() throws IOException {
ArrayList<String> expected = new ArrayList<>();
//expected.add("https://something.com");
//expected.add("some-page.html");
//expected.add("");
List<String> list = List.of("empty-link.md");
for (String string : list) {
Path fileName = Path.of(string);
String contents = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(contents);
assertEquals(expected, links);
}
}
@Test
public void test2() throws IOException {
ArrayList<String> expected = new ArrayList<>();
//expected.add("");
List<String> list = List.of("invalid-website.md");
for (String string : list) {
Path fileName = Path.of(string);
String contents = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(contents);
assertEquals(expected, links);
}
}
@Test
public void testSnippet1() throws IOException {
ArrayList<String> expected = new ArrayList<>();
expected.add("`google.com");
expected.add("google.com");
expected.add("ucsd.edu");
List<String> list = List.of("snippet1.md");
for (String string : list) {
Path fileName = Path.of(string);
String contents = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(contents);
assertEquals(expected, links);
}
}
@Test
public void testSnippet2() throws IOException {
ArrayList<String> expected = new ArrayList<>();
expected.add("a.com");
expected.add("a.com(())");
expected.add("example.edu");
List<String> list = List.of("snippet2.md");
for (String string : list) {
Path fileName = Path.of(string);
String contents = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(contents);
assertEquals(expected, links);
}
}
@Test
public void testSnippet3() throws IOException {
ArrayList<String> expected = new ArrayList<>();
expected.add("https://ucsd-cse15l-w22.github.io/");
List<String> list = List.of("snippet3.md");
for (String string : list) {
Path fileName = Path.of(string);
String contents = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(contents);
assertEquals(expected, links);
}
}
}