forked from nus-cs2103-AY2223S1/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added EventTest and DeadlineTest classes.
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package duke.task; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import java.time.LocalDate; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public class DeadlineTest { | ||
|
||
@Test | ||
public void stringFormatting_unmarkedStringFormatting_success() { | ||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | ||
Deadline deadline = new Deadline("complete CS2103t ip" | ||
, LocalDate.parse("2025-09-25",dtf)); | ||
Assertions.assertEquals("D # F # complete CS2103t ip # 2025-09-25" | ||
,deadline.stringFormatting()); | ||
} | ||
|
||
@Test | ||
public void stringFormatting_markedStringFormatting_success() { | ||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | ||
Deadline deadline = new Deadline("complete CS2103t ip" | ||
, LocalDate.parse("2025-09-25",dtf)); | ||
deadline.setCompleted(true); | ||
Assertions.assertEquals("D # T # complete CS2103t ip # 2025-09-25" | ||
,deadline.stringFormatting()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package duke.task; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.LocalDate; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public class EventTest { | ||
|
||
@Test | ||
public void stringFormatting_unmarkedStringFormatting_success() { | ||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | ||
Event event = new Event("complete CS2103t ip" | ||
, LocalDate.parse("2025-09-25",dtf)); | ||
Assertions.assertEquals("E # F # complete CS2103t ip # 2025-09-25" | ||
,event.stringFormatting()); | ||
} | ||
|
||
@Test | ||
public void stringFormatting_markedStringFormatting_success() { | ||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | ||
Event event = new Event("complete CS2103t ip" | ||
, LocalDate.parse("2025-09-25",dtf)); | ||
event.setCompleted(true); | ||
Assertions.assertEquals("E # T # complete CS2103t ip # 2025-09-25" | ||
,event.stringFormatting()); | ||
} | ||
} |