forked from ucsd-cse15l-w22/markdown-parse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkdownParseTest.java
More file actions
106 lines (100 loc) · 3.39 KB
/
MarkdownParseTest.java
File metadata and controls
106 lines (100 loc) · 3.39 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import static org.junit.Assert.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import org.junit.*;
public class MarkdownParseTest {
@Test
public void addition() {
assertEquals(2, 1 + 1);
}
@Test
public void testGetLinks1(){
String fileName="test-file.md";
List<String> expected=List.of("https://something.com","some-page.html");
try {
assertEquals(expected,MarkdownParse.getLinks(Files.readString(Path.of(fileName))));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Test
public void testGetLinks2(){
String fileName="test-file2.md";
List<String> expected=List.of("https://github.com");
try {
assertEquals(expected,MarkdownParse.getLinks(Files.readString(Path.of(fileName))));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Test
public void testGetLinks3(){
String fileName="test-file3.md";
List<String> expected=List.of();
try {
assertEquals(expected,MarkdownParse.getLinks(Files.readString(Path.of(fileName))));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Test
public void testGetLinks4(){
String fileName="test-file4.md";
List<String> expected=List.of("https://github2.com");
try {
assertEquals(expected,MarkdownParse.getLinks(Files.readString(Path.of(fileName))));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Test
public void testGetLinks5(){
String fileName="test-file5.md";
List<String> expected=List.of("https://github2.com");
try {
assertEquals(expected,MarkdownParse.getLinks(Files.readString(Path.of(fileName))));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Test
public void testlab1(){
String fileName="test-lab4-1.md";
List<String> expected=List.of("`google.com","google.com","ucsd.edu");
try {
assertEquals(expected,MarkdownParse.getLinks(Files.readString(Path.of(fileName))));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Test
public void testlab2(){
String fileName="test-lab4-2.md";
List<String> expected=List.of("a.com", "a.com(())", "example.com");
try {
assertEquals(expected,MarkdownParse.getLinks(Files.readString(Path.of(fileName))));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Test
public void testlab3(){
String fileName="test-lab4-3.md";
List<String> expected=List.of("https://www.twitter.com", "https://ucsd-cse15l-w22.github.io/", "https://cse.ucsd.edu/");
try {
assertEquals(expected,MarkdownParse.getLinks(Files.readString(Path.of(fileName))));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}