forked from ucsd-cse15l-w22/markdown-parse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarkdownParseTest.java
70 lines (60 loc) · 2.4 KB
/
MarkdownParseTest.java
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 org.junit.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
/**
* javac -cp ".;lib\junit-4.13.2.jar;lib\hamcrest-core-1.3.jar" MarkdownParseTest.java
* java -cp ".;lib/junit-4.13.2.jar;lib/hamcrest-core-1.3.jar" org.junit.runner.JUnitCore MarkdownParseTest
*/
public class MarkdownParseTest {
@Test
public void addition() {
Assert.assertEquals(2, 1+1);
}
@Test
public void getLinks() throws IOException{
String[] expected = { "https://something.com", "some-page.html" };
Path fileName = Path.of("test-file.md");
String contents = Files.readString(fileName);
assertEquals(Arrays.asList(expected), MarkdownParse.getLinks(contents));
}
@Test
public void getLinks2() throws IOException{
String[] expected = { "https://ucsd-cse15l-w22.github.io/week/week3/", "https://www.google.com/" };
Path fileName = Path.of("test-file2-own.md");
String contents = Files.readString(fileName);
assertEquals(Arrays.asList(expected), MarkdownParse.getLinks(contents));
}
@Test
public void getLinks3() throws IOException{
String[] expected = { "https://ucsd-cse15l-w22.github.io/week/week3/", "sdfgsdfgsdg","sdfsdfsdfsdf"};
Path fileName = Path.of("test-file3-own.md");
String contents = Files.readString(fileName);
assertEquals(Arrays.asList(expected), MarkdownParse.getLinks(contents));
}
@Test
public void getLinks4() throws IOException{
String[] expected = { "stuff"};
Path fileName = Path.of("test-file4-own.md");
String contents = Files.readString(fileName);
assertEquals(Arrays.asList(expected), MarkdownParse.getLinks(contents));
}
@Test
public void getLinks6() throws IOException{
String[] expected = { };
Path fileName = Path.of("test-file6.md");
String contents = Files.readString(fileName);
assertEquals(Arrays.asList(expected), MarkdownParse.getLinks(contents));
}
@Test
public void getLinks7() throws IOException{
System.out.println("test 7");
String[] expected = { };
Path fileName = Path.of("test-file7.md");
String contents = Files.readString(fileName);
assertEquals(Arrays.asList(expected), MarkdownParse.getLinks(contents));
}
// file has changed
}