-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileReaderTest.java
More file actions
42 lines (37 loc) · 1.32 KB
/
FileReaderTest.java
File metadata and controls
42 lines (37 loc) · 1.32 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
package cs3500.pa05.model;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import cs3500.pa05.model.json.WeekJson;
import java.nio.file.Path;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Tests FileReader
*/
public class FileReaderTest {
private FileReader fileReader;
private FileReader badFileReader;
/**
* Sets up file reader
*/
@BeforeEach
public void setUp() {
badFileReader = new FileReader(Path.of("src/resources/bad"));
fileReader = new FileReader(Path.of("src/test/resources/weekTest.bujo"));
}
/**
* Tests readBujo()
*/
@Test
public void testReadBujo() {
assertThrows(IllegalArgumentException.class, () -> badFileReader.readBujo());
WeekJson weekJson = fileReader.readBujo();
assertEquals("Week Test", weekJson.name());
assertEquals("task2", weekJson.days().get(0).tasks().get(0).name());
assertEquals("Sunday", weekJson.days().get(0).tasks().get(0).day());
assertEquals("false", weekJson.days().get(0).tasks().get(0).completed());
assertEquals(7, weekJson.days().size());
assertEquals(0, weekJson.days().get(0).events().size());
assertEquals("12:00", weekJson.days().get(5).events().get(0).startTime());
}
}