forked from nus-cs2103-AY1718S1/addressbook-level4-old
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/test/java/seedu/room/logic/parser/SwaproomCommandParserTest.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,39 @@ | ||
package seedu.room.logic.parser; | ||
|
||
import static seedu.room.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; | ||
import static seedu.room.logic.parser.CommandParserTestUtil.assertParseFailure; | ||
import static seedu.room.logic.parser.CommandParserTestUtil.assertParseSuccess; | ||
import static seedu.room.testutil.TypicalIndexes.INDEX_FIRST_PERSON; | ||
import static seedu.room.testutil.TypicalIndexes.INDEX_SECOND_PERSON; | ||
|
||
import org.junit.Test; | ||
|
||
import seedu.room.logic.commands.SwaproomCommand; | ||
|
||
/** | ||
* As we are only doing white-box testing, our test cases do not cover path variations | ||
* outside of the DeleteCommand code. For example, inputs "1" and "1 abc" take the | ||
* same path through the DeleteCommand, and therefore we test only one of them. | ||
* The path variation for those two cases occur inside the ParserUtil, and | ||
* therefore should be covered by the ParserUtilTest. | ||
*/ | ||
public class SwaproomCommandParserTest { | ||
|
||
private SwaproomCommandParser parser = new SwaproomCommandParser(); | ||
|
||
@Test | ||
public void parse_validArgs_returnsSwapCommand() { | ||
assertParseSuccess(parser, " 1 2", new SwaproomCommand(INDEX_FIRST_PERSON, INDEX_SECOND_PERSON)); | ||
} | ||
|
||
@Test | ||
public void parse_invalidArgs_throwsParseException() { | ||
assertParseFailure(parser, " a", String.format(MESSAGE_INVALID_COMMAND_FORMAT, SwaproomCommand.MESSAGE_USAGE)); | ||
} | ||
|
||
@Test | ||
public void parse_invalidNumArgs_throwsParseException() { | ||
assertParseFailure(parser, " 1 3 4", String.format(MESSAGE_INVALID_COMMAND_FORMAT, | ||
SwaproomCommand.MESSAGE_USAGE)); | ||
} | ||
} |