forked from nidhidhamnani/markdown-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarkdownParseTest.java
91 lines (73 loc) · 2.95 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
89
90
import static org.junit.Assert.*;
import org.junit.*;
import java.nio.file.Files;
import java.util.*;
import java.nio.file.Path;
import java.io.IOException;
public class MarkdownParseTest {
@Test
public void addition() {
assertEquals(2, 1 + 1);
}
@Test
public void getLinksTest() throws IOException{
Path filePath = Path.of("test-file.md");
String contents = Files.readString(filePath);
ArrayList<String> links = new MarkdownParse().getLinks(contents);
assertEquals("some-thing.html",links.get(1));
}
@Test
public void getLinksTest2() throws IOException{
Path filePath = Path.of("test2.md");
String contents = Files.readString(filePath);
ArrayList<String> links = new MarkdownParse().getLinks(contents);
ArrayList<String> linkEmpty = new ArrayList<>();
assertEquals(linkEmpty,links);
}
@Test
public void getLinksTest3() throws IOException{
Path filePath = Path.of("test3.md");
String contents = Files.readString(filePath);
ArrayList<String> links = new MarkdownParse().getLinks(contents);
ArrayList<String> linkEmpty = new ArrayList<>();
assertEquals(linkEmpty,links);
}
@Test
public void getLinksTest4() throws IOException{
Path filePath = Path.of("test4.md");
String contents = Files.readString(filePath);
ArrayList<String> links = new MarkdownParse().getLinks(contents);
ArrayList<String> linkEmpty = new ArrayList<>();
assertEquals(linkEmpty,links);
}
/*@Test
public void getLinksTest5() throws IOException{
Path filePath = Path.of("test5.md");
String contents = Files.readString(filePath);
ArrayList<String> links = new MarkdownParse().getLinks(contents);
ArrayList<String> linkEmpty = new ArrayList<>();
assertEquals("a",links.get(0));
}*/
@Test
public void labReport1() throws IOException{
Path filePath = Path.of("LabReportTest1.md");
String contents = Files.readString(filePath);
ArrayList<String> links = new MarkdownParse().getLinks(contents);
assertEquals(List.of("%60google.com", "google.com", "ucsd.edu"),links);
}
@Test
public void labReport2() throws IOException{
Path filePath = Path.of("LabReportTest2.md");
String contents = Files.readString(filePath);
ArrayList<String> links = new MarkdownParse().getLinks(contents);
assertEquals(List.of("a.com", "a.com(())", "example.com"),links);
}
@Test
public void labReport3() throws IOException{
Path filePath = Path.of("LabReportTest3.md");
String contents = Files.readString(filePath);
ArrayList<String> links = new MarkdownParse().getLinks(contents);
assertEquals(List.of("https://sites.google.com/eng.ucsd.edu/cse-15l-spring-2022/schedule")
,links);
}
}