forked from cse15lss122/markdown-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkdownParseTest.java
More file actions
72 lines (56 loc) · 2.06 KB
/
MarkdownParseTest.java
File metadata and controls
72 lines (56 loc) · 2.06 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
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 testLinks1() throws IOException{
String content = Files.readString(Path.of("test-file.md"));
assertEquals(List.of("https://something.com", "some-thing.html"), MarkdownParse.getLinks(content));
}
@Test
public void testLinks2() throws IOException{
String content = Files.readString(Path.of("test-file2.md"));
assertEquals(List.of("https://google.com", "some-thing.html"), MarkdownParse.getLinks(content));
}
@Test
public void testLinks3() throws IOException{
String content = Files.readString(Path.of("test-file3.md"));
assertEquals(List.of("more text here"), MarkdownParse.getLinks(content));
}
@Test
public void testLinks7() throws IOException{
String content = Files.readString(Path.of("test-file7.md"));
assertEquals(true, MarkdownParse.getLinks(content).isEmpty());
}
//New Test
@Test
public void getCorrectLinks4() throws IOException{
String content = Files.readString(Path.of("test-file4.md"));
assertEquals(List.of(""),MarkdownParse.getLinks(content));
}
//New Test
@Test
public void getCorrectLinks5() throws IOException{
String content = Files.readString(Path.of("test-file5.md"));
assertEquals(List.of("page.com"),MarkdownParse.getLinks(content));
}
//New Test
@Test
public void getCorrectLinks6() throws IOException{
String content = Files.readString(Path.of("test-file6.md"));
assertEquals(List.of(""),MarkdownParse.getLinks(content));
}
//New Test
@Test
public void getCorrectLinks8() throws IOException{
String content = Files.readString(Path.of("test-file8.md"));
assertEquals(List.of("a link on the first line"),MarkdownParse.getLinks(content));
}
}