Skip to content

Commit

Permalink
Add JUnit for NextDayCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
Cazh1 committed Nov 7, 2023
1 parent 82f1656 commit 24bb96a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/test/java/seedu/cafectrl/command/NextDayCommandTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package seedu.cafectrl.command;

import org.junit.jupiter.api.Test;
import seedu.cafectrl.data.CurrentDate;
import seedu.cafectrl.data.Sales;
import seedu.cafectrl.ui.Ui;

class NextDayCommandTest {
@Test
public void execute_oneNextDay_expectDayTwo() {
Ui ui = new Ui();
Sales sales = new Sales();
CurrentDate currentDate = new CurrentDate(sales);
Command nextDayCommand = new NextDayCommand(ui, sales, currentDate);
nextDayCommand.execute();
int actualDay = currentDate.getCurrentDay() + 1;
int expectedDay = 2;
assert actualDay == expectedDay;
}

@Test
public void execute_nineNextDay_expectDayTen() {
Ui ui = new Ui();
Sales sales = new Sales();
CurrentDate currentDate = new CurrentDate(sales);
for (int i = 0; i < 9; i ++) {
Command nextDayCommand = new NextDayCommand(ui, sales, currentDate);
nextDayCommand.execute();
}
int actualDay = currentDate.getCurrentDay() + 1;
int expectedDay = 10;
assert actualDay == expectedDay;
}
}

0 comments on commit 24bb96a

Please sign in to comment.