forked from ucsd-cse15l-w22/markdown-parse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkdownParseTest.java
More file actions
58 lines (48 loc) · 1.73 KB
/
MarkdownParseTest.java
File metadata and controls
58 lines (48 loc) · 1.73 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
import static org.junit.Assert.*;
import org.junit.*;
import java.beans.Transient;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
public class MarkdownParseTest {
@Test
public void addition() {
assertEquals(2, 1 + 1);
}
@Test
public void testGetLinks() throws IOException {
Path fileName = Path.of("test-file.md");
String contents = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(contents);
assertEquals("https://something.com", links.get(0));
assertEquals("some-page.html", links.get(1));
}
@Test
public void testGetLinks2() throws IOException {
Path fileName = Path.of("ms.md");
String contents = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(contents);
// Expected output
ArrayList<String> expectedoutput = new ArrayList<>();
assertEquals(links, expectedoutput);
}
@Test
public void testGetLinks3() throws IOException {
Path fileName = Path.of("cs1.md");
String contents = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(contents);
// Expected output
ArrayList<String> expectedoutput = new ArrayList<>();
assertEquals(links, expectedoutput);
}
@Test
public void testGetLinks4() throws IOException {
Path fileName = Path.of("woohoo.md");
String contents = Files.readString(fileName);
ArrayList<String> links = MarkdownParse.getLinks(contents);
// Expected output
ArrayList<String> expectedoutput = new ArrayList<>();
assertEquals(links, expectedoutput);
}
}