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
70 lines (50 loc) · 1.92 KB
/
MarkdownParseTest.java
File metadata and controls
70 lines (50 loc) · 1.92 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
import static org.junit.Assert.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import org.junit.*;
public class MarkdownParseTest {
MarkdownParse parser;
@Before
public void setUp() throws Exception{
parser = new MarkdownParse();
}
@Test
public void addition(){
assertEquals(2, 1 + 1);
}
@Test
public void getLinksTest() throws IOException{
List expected = List.of("https://something.com", "some-thing.html");
Path filePath = Path.of("additionaltests/test-file.md");
String content = Files.readString(filePath);
ArrayList<String> getLinksOutput = parser.getLinks(content);
assertEquals(expected, getLinksOutput);
}
@Test
public void getLinksNewTest() throws IOException{
List expected = List.of("http://corndogoncorndog.com/", "corn-dog.html", "youtube.com", "https://www.ihasabucket.com/");
Path filePath = Path.of("new-test-file.md");
String content = Files.readString(filePath);
ArrayList<String> getLinksOutput = parser.getLinks(content);
assertEquals(expected, getLinksOutput);
}
@Test
public void getLinksOtherTest() throws IOException{
List expected = List.of("https://www.uol.com.br/");
Path filePath = Path.of("other-test-file.md");
String content = Files.readString(filePath);
ArrayList<String> getLinksOutput = parser.getLinks(content);
assertEquals(expected, getLinksOutput);
}
@Test
public void getLinksLastTest() throws IOException{
List expected = List.of("");
Path filePath = Path.of("last-test-file.md");
String content = Files.readString(filePath);
ArrayList<String> getLinksOutput = parser.getLinks(content);
assertEquals(expected, getLinksOutput);
}
}