forked from nidhidhamnani/markdown-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkdownParseTest.java
More file actions
47 lines (41 loc) · 1.6 KB
/
MarkdownParseTest.java
File metadata and controls
47 lines (41 loc) · 1.6 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
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.ArrayList;
import java.util.List;
public class MarkdownParseTest {
@Test
public void addition() {
assertEquals(2, 1 + 1);
}
@Test
public void testGetLinks() throws IOException {
Path path = Path.of("test-file.md");
String readString = Files.readString(path);
ArrayList<String> links = MarkdownParse.getLinks(readString);
assertEquals(List.of("https://something.com", "some-thing.html"), links);
}
@Test
public void snippet1Test() throws IOException {
Path fileName = Path.of("snippet1Tester.md");
String readString = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(readString);
assertEquals(List.of("`google.com", "google.com", "ucsd.edu"), links);
}
@Test
public void snippet2Test() throws IOException {
Path fileName = Path.of("snippet2Tester.md");
String readString = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(readString);
assertEquals(List.of("a.com(())", "example.com"), links);
}
@Test
public void snippet3Test() throws IOException {
Path fileName = Path.of("snippet3Tester.md");
String readString = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(readString);
assertEquals(List.of("https://ucsd-cse15l-w22.github.io/"), links);
}
}