forked from nus-cs2113-AY2324S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #286
- Loading branch information
Showing
2 changed files
with
36 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
33 changes: 33 additions & 0 deletions
33
src/test/java/seedu/cafectrl/command/PreviousDayCommandTest.java
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,33 @@ | ||
package seedu.cafectrl.command; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import seedu.cafectrl.data.CurrentDate; | ||
import seedu.cafectrl.ui.Ui; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class PreviousDayCommandTest { | ||
@Test | ||
public void execute_setTwoDayOneRun_expectDayOne() { | ||
Ui ui = new Ui(); | ||
CurrentDate currentDate = new CurrentDate(2); | ||
Command previousDayCommand = new PreviousDayCommand(ui, currentDate); | ||
previousDayCommand.execute(); | ||
int actualDay = currentDate.getCurrentDay() + 1; | ||
int expectedDay = 1; | ||
assert actualDay == expectedDay; | ||
} | ||
|
||
@Test | ||
public void execute_setTenDayNineRun_expectDayOne() { | ||
Ui ui = new Ui(); | ||
CurrentDate currentDate = new CurrentDate(10); | ||
for (int i = 0; i < 9; i++) { | ||
Command previousDayCommand = new PreviousDayCommand(ui, currentDate); | ||
previousDayCommand.execute(); | ||
} | ||
int actualDay = currentDate.getCurrentDay() + 1; | ||
int expectedDay = 1; | ||
assert actualDay == expectedDay; | ||
} | ||
} |