Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test cases for view stall #216

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ public void equals() {
assertFalse(viewFirstCommand.equals(viewSecondCommand));
}

@Test
public void equals_sameObject_true() {
Index index = Index.fromZeroBased(1);
ViewStallCommand viewStallCommand = new ViewStallCommand(index);

assertTrue(viewStallCommand.equals(viewStallCommand));
}

@Test
public void equals_nullObject_false() {
Index index = Index.fromZeroBased(1);
ViewStallCommand viewStallCommand = new ViewStallCommand(index);

assertFalse(viewStallCommand.equals(null));
}

@Test
public void toStringMethod() {
Index targetIndex = Index.fromOneBased(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_STALL_DISPLAYED_INDEX;
import static seedu.address.logic.commands.CommandTestUtil.PREAMBLE_WHITESPACE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_STALL;
Expand Down Expand Up @@ -27,5 +28,33 @@ public void parse_invalidArgs_throwsParseException() {
assertParseFailure(parser, userInput, String.format(MESSAGE_INVALID_STALL_DISPLAYED_INDEX,
ViewStallCommand.MESSAGE_USAGE));
}

@Test
public void parse_emptyArgs_throwsParseException() {
String userInput = PREAMBLE_WHITESPACE + " " + PREFIX_STALL + "";
assertParseFailure(parser, userInput, String.format(MESSAGE_INVALID_STALL_DISPLAYED_INDEX,
ViewStallCommand.MESSAGE_USAGE));
}

@Test
public void parse_spaceArgs_throwsParseException() {
String userInput = PREAMBLE_WHITESPACE + " " + PREFIX_STALL + " ";
assertParseFailure(parser, userInput, String.format(MESSAGE_INVALID_STALL_DISPLAYED_INDEX,
ViewStallCommand.MESSAGE_USAGE));
}

@Test
public void parse_multipleArgs_throwsParseException() {
String userInput = PREAMBLE_WHITESPACE + " " + PREFIX_STALL + "1 2 3";
assertParseFailure(parser, userInput, String.format(MESSAGE_INVALID_STALL_DISPLAYED_INDEX,
ViewStallCommand.MESSAGE_USAGE));
}

@Test
public void parse_noPrefix_throwsParseException() {
String userInput = PREAMBLE_WHITESPACE + " " + "1";
assertParseFailure(parser, userInput, String.format(MESSAGE_INVALID_COMMAND_FORMAT,
ViewStallCommand.MESSAGE_USAGE));
}
}