forked from ShashankVenkatramani/markdown-parse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkdownParseTest.java
More file actions
84 lines (79 loc) · 3.08 KB
/
MarkdownParseTest.java
File metadata and controls
84 lines (79 loc) · 3.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
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.List;
import java.util.ArrayList;
public class MarkdownParseTest {
@Test
public void testDefaultLinkMethod() throws IOException {
Path fileName = Path.of("test-file.md");
String contents = Files.readString(fileName);
assertEquals(List.of("https://something.com", "some-page.html"), MarkdownParse.getLinks(contents));
}
@Test
public void testOneLinkMethod() throws IOException {
Path fileName = Path.of("markdown-new-test.md");
String contents = Files.readString(fileName);
assertEquals(List.of("thiswillbreak.com", "thisisover.com", "peasy.html"), MarkdownParse.getLinks(contents));
}
@Test
public void testTwoLinkMethod() throws IOException {
Path fileName = Path.of("markdown-test-two.md");
String contents = Files.readString(fileName);
assertEquals(List.of("thiswillbreak.com", "thisisover.com", "peasy.html"), MarkdownParse.getLinks(contents));
}
@Test
public void testThreeLinkMethod() throws IOException {
Path fileName = Path.of("markdown-test-three.md");
String contents = Files.readString(fileName);
assertEquals(List.of("thiswillbreak.com", "thisisover.com", "peasy.html"), MarkdownParse.getLinks(contents));
}
//Tests from Joe's new repos
@Test
public void joesNewTestTwo() throws IOException {
assertEquals(List.of("https://something.com", "some-page.html"),
MarkdownParse.getLinks(getContents("test-file2.md")));
}
@Test
public void joesNewTestThree() throws IOException {
assertEquals(List.of(),
MarkdownParse.getLinks(getContents("test-file3.md")));
}
@Test
public void joesNewTestFour() throws IOException {
assertEquals(new ArrayList<String>(),
MarkdownParse.getLinks(getContents("test-file4.md")));
}
@Test
public void joesNewTestFive() throws IOException {
assertEquals(List.of("page.com"),
MarkdownParse.getLinks(getContents("test-file5.md")));
}
@Test
public void joesNewTestSix() throws IOException {
assertEquals(List.of("page.com"),
MarkdownParse.getLinks(getContents("test-file6.md")));
}
@Test
public void joesNewTestSeven() throws IOException {
assertEquals(new ArrayList<String>(),
MarkdownParse.getLinks(getContents("test-file7.md")));
}
@Test
public void joesNewTestEight() throws IOException {
assertEquals(new ArrayList<String>(),
MarkdownParse.getLinks(getContents("test-file8.md")));
}
public static String getContents(String filePath) throws IOException {
Path fileName = Path.of(filePath);
String contents = Files.readString(fileName);
return contents;
}
@Test
public void joesNewTestNine() throws IOException {
assertEquals(List.of("something.com"),
MarkdownParse.getLinks(getContents("test-file9.md")));
}
}