forked from nus-cs2103-AY2324S2/tp
-
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.
Merge pull request #177 from ashleyy2444/branch-addTestCaseFilterPL
Add test cases for filter programming language feature
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
src/test/java/seedu/address/logic/parser/FilterProgrammingLanguageCommandParserTest.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.address.logic.parser; | ||
|
||
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; | ||
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure; | ||
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess; | ||
import static seedu.address.logic.parser.FilterProgrammingLanguageCommandParser.createLanguages; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.logic.commands.FilterProgrammingLanguageCommand; | ||
import seedu.address.logic.parser.exceptions.ParseException; | ||
import seedu.address.model.language.ProgrammingLanguageContainsKeywordsPredicate; | ||
|
||
public class FilterProgrammingLanguageCommandParserTest { | ||
private FilterProgrammingLanguageCommandParser parser = new FilterProgrammingLanguageCommandParser(); | ||
|
||
@Test | ||
public void parse_emptyArg_throwsParseException() { | ||
assertParseFailure(parser, " ", String.format(MESSAGE_INVALID_COMMAND_FORMAT, | ||
FilterProgrammingLanguageCommand.MESSAGE_USAGE)); | ||
} | ||
|
||
@Test | ||
public void parse_validArgs_returnsFilterTagCommand() throws ParseException { | ||
// no leading and trailing whitespaces | ||
FilterProgrammingLanguageCommand expectedFilterProgrammingLanguageCommand = | ||
new FilterProgrammingLanguageCommand(new ProgrammingLanguageContainsKeywordsPredicate( | ||
createLanguages("Java", "Python"))); | ||
assertParseSuccess(parser, "Java Python", expectedFilterProgrammingLanguageCommand); | ||
|
||
// multiple whitespaces between keywords | ||
assertParseSuccess(parser, " \n Java \n \t Python \t", expectedFilterProgrammingLanguageCommand); | ||
} | ||
} |