Skip to content

Commit

Permalink
A-JUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
Evande1 committed Aug 26, 2022
1 parent 59b3d48 commit a35e5db
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
24 changes: 24 additions & 0 deletions src/test/java/duke/task/DeadlineTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package duke.task;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DeadlineTest {
@Test
public void deadlineTestToString() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HHmm");
Deadline test = new Deadline("test", LocalDateTime.parse("01/01/2025 1600",formatter));
assertEquals("[D][ ] test (by: Jan 1 2025 1600)", test.toString());
}

@Test
public void deadlineTestTextFormat() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HHmm");
Deadline test = new Deadline("test", LocalDateTime.parse("01/01/2025 1600",formatter));
assertEquals("D|0|test|2025-01-01T16:00", test.textFormat());
}
}
19 changes: 19 additions & 0 deletions src/test/java/duke/task/EventsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package duke.task;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class EventsTest {
@Test
public void EventsTestToString() {
Events test = new Events("test", "test");
assertEquals("[E][ ] test (by: test)", test.toString());
}

@Test
public void EventsTestTextFormat() {
Events test = new Events("test", "test");
assertEquals("E|0|test|test", test.textFormat());
}
}
19 changes: 19 additions & 0 deletions src/test/java/duke/task/ToDosTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package duke.task;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class ToDosTest {
@Test
public void ToDosTestToString() {
ToDos test = new ToDos("test");
assertEquals("[T][ ] test", test.toString());
}

@Test
public void ToDosTextFormat() {
ToDos test = new ToDos("test");
assertEquals("T|0|test", test.textFormat());
}
}
2 changes: 1 addition & 1 deletion text-ui-test/input.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
todo borrow book
list
deadline return book /by Sunday
deadline return book /by
event project meeting /at Mon 2-4pm

0 comments on commit a35e5db

Please sign in to comment.