Skip to content

Commit

Permalink
Update SortCommandParserTest to use PREFIX instead of explicit String
Browse files Browse the repository at this point in the history
  • Loading branch information
whitesnowx committed Mar 15, 2024
1 parent 16283a8 commit 6da8468
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/test/java/staffconnect/logic/parser/SortCommandParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import static staffconnect.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static staffconnect.logic.parser.CliSyntax.PREFIX_VENUE;
import static staffconnect.logic.parser.CommandParserTestUtil.assertParseFailure;
import static staffconnect.logic.parser.CommandParserTestUtil.assertParseSuccess;

Expand All @@ -24,15 +25,18 @@ public void parse_validArgs_returnsSortCommand() {

SortCommand expectedSortCommand = new SortCommand(VenueComparator.VENUE_COMPARATOR);

// no leading and trailing whitespaces
assertParseSuccess(parser, " v/ ", expectedSortCommand);
// no leading and no trailing whitespaces
assertParseSuccess(parser, "" + PREFIX_VENUE, expectedSortCommand);

// multiple whitespaces before and after keywords
assertParseSuccess(parser, " v/ ", expectedSortCommand);
// 1 leading and no trailing whitespaces
assertParseSuccess(parser, " " + PREFIX_VENUE, expectedSortCommand);

// no leading and 1 trailing whitespaces
assertParseSuccess(parser, PREFIX_VENUE + " ", expectedSortCommand);

// multiple whitespaces before and after keywords
assertParseSuccess(parser, " " + PREFIX_VENUE + " ", expectedSortCommand);

assertParseFailure(parser, " /p ", String.format(MESSAGE_INVALID_COMMAND_FORMAT,
SortCommand.MESSAGE_USAGE));
}

}

0 comments on commit 6da8468

Please sign in to comment.