-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkdownParseTest.java
More file actions
88 lines (75 loc) · 2.79 KB
/
MarkdownParseTest.java
File metadata and controls
88 lines (75 loc) · 2.79 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
85
86
87
88
import java.util.ArrayList;
import java.util.List;
// import java.util.Scanner;
import static org.junit.Assert.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.junit.*;
public class MarkdownParseTest {
@Test
public void addition() {
// “assertEquals()” has two arguments. Will pass if the first arguement
// is equal to the second
assertEquals(2, 1 + 1);
}
@Test
public void testParse() throws IOException {
List<String> exp = List.of("https://something.com", "some-thing.html");
Path file = Path.of("test-file.md");
String content = Files.readString(file);
ArrayList<String> act = MarkdownParse.getLinks(content);
assertEquals(exp, act);
}
@Test
public void testImage() throws IOException {
ArrayList<String> exp = new ArrayList<String>();
Path file = Path.of("testImage.md");
String content = Files.readString(file);
ArrayList<String> act = MarkdownParse.getLinks(content);
assertEquals(exp, act);
}
@Test
public void testParen() throws IOException {
List<String> exp = List.of("https://angeliazddl.github.io/markdown-parser/");
Path file = Path.of("testParen.md");
String content = Files.readString(file);
ArrayList<String> act = MarkdownParse.getLinks(content);
assertEquals(exp, act);
}
@Test
public void testBracket() throws IOException {
List<String> exp = List.of("https://angeliazddl.github.io/markdown-parser/");
Path file = Path.of("testBracket.md");
String content = Files.readString(file);
ArrayList<String> act = MarkdownParse.getLinks(content);
assertEquals(exp, act);
}
@Test
public void testSnippet1() throws IOException {
List<String> exp = new ArrayList<>();
Path file = Path.of("Snippet1.md");
// Scanner content = new Scanner(file);
String content = Files.readString(file);
ArrayList<String> act = MarkdownParse.getLinks(content);
assertEquals(exp, act);
}
@Test
public void testSnippet2() throws IOException {
List<String> exp = new ArrayList<>();
Path file = Path.of("Snippet2.md");
// Scanner content = new Scanner(file);
String content = Files.readString(file);
ArrayList<String> act = MarkdownParse.getLinks(content);
assertEquals(exp, act);
}
@Test
public void testSnippet3() throws IOException {
List<String> exp = new ArrayList<>();
Path file = Path.of("Snippet3.md");
// Scanner content = new Scanner(file);
String content = Files.readString(file);
ArrayList<String> act = MarkdownParse.getLinks(content);
assertEquals(exp, act);
}
}