Skip to content

Commit 5164155

Browse files
committed
Add J-Unit test
1 parent 60c63e9 commit 5164155

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package tasks;
2+
3+
import exceptions.DukeException;
4+
import org.junit.jupiter.api.Test;
5+
6+
import java.time.LocalDateTime;
7+
import java.time.format.DateTimeFormatter;
8+
9+
import static org.junit.jupiter.api.Assertions.assertEquals;
10+
11+
public class DeadlineTest {
12+
13+
@Test
14+
public void descriptionTest() throws DukeException {
15+
String name = "should output this";
16+
LocalDateTime date = LocalDateTime.parse("10/12/2022 1020", DateTimeFormatter.ofPattern("dd/MM/yyyy HHmm"));
17+
Deadline test = new Deadline(name, date);
18+
assertEquals("[D][ ] should output this (by 1020, Dec 10 2022)", test.toString());
19+
}
20+
21+
@Test
22+
public void markTest() throws DukeException {
23+
String name = "should output this";
24+
LocalDateTime date = LocalDateTime.parse("10/12/2022 1020", DateTimeFormatter.ofPattern("dd/MM/yyyy HHmm"));
25+
Deadline test = new Deadline(name, date);
26+
test.markAsDone();
27+
assertEquals("[D][X] should output this (by 1020, Dec 10 2022)", test.toString());
28+
test.markAsUndone();
29+
assertEquals("[D][ ] should output this (by 1020, Dec 10 2022)", test.toString());
30+
}
31+
32+
}

0 commit comments

Comments
 (0)