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
81 lines (77 loc) · 2.96 KB
/
MarkdownParseTest.java
File metadata and controls
81 lines (77 loc) · 2.96 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
import static org.junit.Assert.*;
import org.junit.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.io.IOException;
import java.util.ArrayList;
public class MarkdownParseTest {
@Test
public void addition(){
assertEquals(2,1+1);
}
@Test
public void testgetLinks() throws IOException {
ArrayList<String> toReturn = new ArrayList<>();
toReturn.add("https://something.com");
toReturn.add("some-thing.html");
Path fileName = Path.of("test-file.md");
String content = Files.readString(fileName);
assertEquals(toReturn, MarkdownParse.getLinks(content));
}
@Test
public void test1getLinks() throws IOException {
ArrayList<String> toReturn = new ArrayList<>();
toReturn.add("somethingtem t.com");
Path fileName = Path.of("test-file1.md");
String content = Files.readString(fileName);
assertEquals(toReturn, MarkdownParse.getLinks(content));
}
@Test
public void test2getLinks() throws IOException {
ArrayList<String> toReturn = new ArrayList<>();
toReturn.add("somethingting.com");
Path fileName = Path.of("test-file2.md");
String content = Files.readString(fileName);
assertEquals(toReturn, MarkdownParse.getLinks(content));
}
@Test
public void test3getLinks() throws IOException {
ArrayList<String> toReturn = new ArrayList<>();
toReturn.add(" ");
Path fileName = Path.of("test-file3.md");
String content = Files.readString(fileName);
assertEquals(toReturn, MarkdownParse.getLinks(content));
}
@Test
public void testSnippet1() throws IOException{
ArrayList<String> expected = new ArrayList<>();
expected.add("'google.com");
MarkdownParse snippet1 = new MarkdownParse();
Path fileName = Path.of("snippet1.md");
String content = Files.readString(fileName);
ArrayList<String> actual = snippet1.getLinks(fileName);
assertEquals(expected,actual);
}
@Test
public void testSnippet2() throws IOException{
ArrayList<String> expected = new ArrayList<>();
expected.add("a.com");
expected.add("a,com(())");
expected.add("example.com");
MarkdownParse snippet2 = new MarkdownParse();
Path fileName = Path.of("snippet2.md");
String content = Files.readString(fileName);
ArrayList<String> actual = snippet2.getLinks(fileName);
assertEquals(expected,actual);
}
@Test
public void testSnippet3() throws IOException{
ArrayList<String> expected = new ArrayList<>();
expected.add("https://sites.google.com/eng.ucsd.edu/cse-15l-spring-2022/schedule");
MarkdownParse snippet3 = new MarkdownParse();
Path fileName = Path.of("snippet3.md");
String content = Files.readString(fileName);
ArrayList<String> actual = snippet3.getLinks(fileName);
assertEquals(expected,actual);
}
}