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
33 lines (28 loc) · 1.09 KB
/
MarkdownParseTest.java
File metadata and controls
33 lines (28 loc) · 1.09 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
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 testFile1() throws IOException {
String contents= Files.readString(Path.of("Snippet1.md"));
List<String> expect = List.of("`google.com", "google.com", "ucsd.edu");
assertEquals(expect,MarkdownParse.getLinks(contents));
}
@Test
public void testFile2() throws IOException {
String contents= Files.readString(Path.of("Snippet2.md"));
List<String> expect = List.of("a.com(())", "example.com");
assertEquals(expect,MarkdownParse.getLinks(contents));
}
@Test
public void testSingleImage() throws IOException {
String contents= Files.readString(Path.of("Snippet3.md"));
List<String> expect = List.of("https://www.twitter.com",
"https://sites.google.com/eng.ucsd.edu/cse-15l-spring-2022/schedule",
"https://cse.ucsd.edu/");
assertEquals(expect, MarkdownParse.getLinks(contents));
}
}