forked from nus-cs2103-AY1920S1/addressbook-level3
-
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.
- Loading branch information
1 parent
69eb6b9
commit 11c3e81
Showing
20 changed files
with
265 additions
and
107 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
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
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
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
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
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
24 changes: 0 additions & 24 deletions
24
src/main/java/seedu/billboard/logic/parser/HistoryCommandParser.java
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/main/java/seedu/billboard/logic/parser/RedoCommandParser.java
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/main/java/seedu/billboard/logic/parser/UndoCommandParser.java
This file was deleted.
Oops, something went wrong.
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
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
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
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
35 changes: 35 additions & 0 deletions
35
src/test/java/seedu/billboard/logic/commands/HistoryCommandTest.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,35 @@ | ||
package seedu.billboard.logic.commands; | ||
|
||
import static seedu.billboard.logic.commands.CommandTestUtil.assertCommandSuccess; | ||
import static seedu.billboard.testutil.TypicalExpenses.getTypicalBillboard; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.billboard.model.Model; | ||
import seedu.billboard.model.ModelManager; | ||
import seedu.billboard.model.UserPrefs; | ||
import seedu.billboard.model.history.CommandHistory; | ||
|
||
|
||
|
||
class HistoryCommandTest { | ||
private Model model; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
model = new ModelManager(getTypicalBillboard(), new UserPrefs()); | ||
CommandHistory.clearHistory(); | ||
CommandHistory.addCmdHistory("history"); | ||
} | ||
|
||
@Test | ||
void execute() { | ||
//Empty history -> empty history message | ||
HistoryCommand historyCommand = new HistoryCommand(); | ||
assertCommandSuccess(historyCommand, model, HistoryCommand.MESSAGE_EMPTY_HISTORY, model); | ||
//Not empty history -> history records | ||
CommandHistory.addCmdHistory("history"); | ||
assertCommandSuccess(historyCommand, model, String.format(CommandHistory.HAVE_HISTORY, "\n\thistory"), model); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/test/java/seedu/billboard/logic/commands/RedoCommandTest.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,41 @@ | ||
package seedu.billboard.logic.commands; | ||
|
||
import static seedu.billboard.logic.commands.CommandTestUtil.assertCommandFailure; | ||
import static seedu.billboard.logic.commands.CommandTestUtil.assertCommandSuccess; | ||
import static seedu.billboard.testutil.TypicalExpenses.getDeleteTypicalBillboard; | ||
import static seedu.billboard.testutil.TypicalExpenses.getTypicalBillboard; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.billboard.commons.core.Messages; | ||
import seedu.billboard.model.Model; | ||
import seedu.billboard.model.ModelManager; | ||
import seedu.billboard.model.UserPrefs; | ||
import seedu.billboard.model.versionedbillboard.VersionedBillboard; | ||
|
||
class RedoCommandTest { | ||
private Model model; | ||
private RedoCommand redo; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
model = new ModelManager(getTypicalBillboard(), new UserPrefs()); | ||
VersionedBillboard.clearList(); | ||
VersionedBillboard.commit(model); | ||
redo = new RedoCommand(); | ||
} | ||
|
||
@Test | ||
void execute() { | ||
assertCommandFailure(redo, model, Messages.MESSAGE_NOT_REDOABLE); | ||
Model deleteModel = new ModelManager(getDeleteTypicalBillboard(), new UserPrefs()); | ||
VersionedBillboard.commit(deleteModel); | ||
String deleteCmd = "delete 1"; | ||
VersionedBillboard.addCmd(deleteCmd); | ||
VersionedBillboard.undo(); | ||
|
||
String expectedMessage = String.format(RedoCommand.MESSAGE_REDO_SUCCESS, deleteCmd); | ||
assertCommandSuccess(redo, model, expectedMessage, deleteModel); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/test/java/seedu/billboard/logic/commands/UndoCommandTest.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,34 @@ | ||
package seedu.billboard.logic.commands; | ||
|
||
import static seedu.billboard.logic.commands.CommandTestUtil.assertCommandFailure; | ||
import static seedu.billboard.logic.commands.CommandTestUtil.assertCommandSuccess; | ||
import static seedu.billboard.testutil.TypicalExpenses.getDeleteTypicalBillboard; | ||
import static seedu.billboard.testutil.TypicalExpenses.getTypicalBillboard; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.billboard.commons.core.Messages; | ||
import seedu.billboard.model.Model; | ||
import seedu.billboard.model.ModelManager; | ||
import seedu.billboard.model.UserPrefs; | ||
import seedu.billboard.model.versionedbillboard.VersionedBillboard; | ||
|
||
class UndoCommandTest { | ||
|
||
@Test | ||
void execute() { | ||
Model model = new ModelManager(getTypicalBillboard(), new UserPrefs()); | ||
Model deleteModel = new ModelManager(getDeleteTypicalBillboard(), new UserPrefs()); | ||
Model expectedModel = new ModelManager(model.getBillboard(), new UserPrefs()); | ||
VersionedBillboard.clearList(); | ||
VersionedBillboard.commit(model); | ||
UndoCommand undo = new UndoCommand(); | ||
assertCommandFailure(undo, model, Messages.MESSAGE_NOT_UNDOABLE); | ||
VersionedBillboard.commit(deleteModel); | ||
String deleteCmd = "delete 1"; | ||
VersionedBillboard.addCmd(deleteCmd); | ||
String expectedMessage = String.format(UndoCommand.MESSAGE_UNDO_SUCCESS, deleteCmd); | ||
assertCommandSuccess(undo, deleteModel, expectedMessage, expectedModel); | ||
} | ||
|
||
} |
Oops, something went wrong.