-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMarkdownParseTest.java
More file actions
142 lines (103 loc) · 4.08 KB
/
MarkdownParseTest.java
File metadata and controls
142 lines (103 loc) · 4.08 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//compiling:
//javac -cp .:lib/junit-4.13.2.jar:lib/hamcrest-core-1.3.jar MarkdownParseTest.java
//java -cp .:lib/junit-4.13.2.jar:lib/hamcrest-core-1.3.jar org.junit.runner.JUnitCore MarkdownParseTest
import static org.junit.Assert.*;
import org.junit.*;
import java.io.IOException;
import java.util.*;
import java.nio.file.Path;
import java.nio.file.Files;
public class MarkdownParseTest {
@Test
public void Test1() throws IOException{
List expected = List.of("https://something.com","some-thing.html");
Path fileName = Path.of("test-file.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Test2() throws IOException{
List expected = List.of("https://something.com","some-page.html");
Path fileName = Path.of("test-file2.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Test3() throws IOException{
List expected = List.of();
Path fileName = Path.of("test-file3.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Test4() throws IOException{
List expected = List.of();
Path fileName = Path.of("test-file4.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Test5() throws IOException{
List expected = List.of();
Path fileName = Path.of("test-file5.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Test6() throws IOException{
List expected = List.of();
Path fileName = Path.of("test-file6.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Test7() throws IOException{
List expected = List.of();
Path fileName = Path.of("test-file7.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Test8() throws IOException{
List expected = List.of("a link on the first line");
Path fileName = Path.of("test-file8.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Snippet1() throws IOException{
List expected = List.of("%60google.com", "google.com", "google.com", "ucsd.edu");
Path fileName = Path.of("test-snippet1.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Snippet2() throws IOException{
List expected = List.of("a.com", "a.com(())", "example.com");
Path fileName = Path.of("test-snippet2.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
@Test
public void Snippet3() throws IOException{
List expected = List.of(
"https://www.twitter.com",
"https://sites.google.com/eng.ucsd.edu/cse-15l-spring-2022/schedule",
"https://cse.ucsd.edu/"
);
Path fileName = Path.of("test-snippet3.md");
String content = Files.readString(fileName);
ArrayList<String> actual = MarkdownParse.getLinks(content);
assertEquals(expected, actual);
}
}