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

[W5.4r][F09-B4] Liu Hang #926

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
24 changes: 22 additions & 2 deletions test/java/seedu/addressbook/parser/ParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,23 @@ public void listCommand_parsedCorrectly() {
}

@Test
public void sortCommand_parsedCorrectly() {
public void sortCommand_noArgs_parsedCorrectly() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have successfully implemented Unit tests!

But you still need to add IO tests for your feature.
IO tests help assess the end-to-end correctness of a program.
You will need to add input.txt and expected.txt files along with a batch script to compare your programs output to the expected output.

final String input = "sort";
parseAndAssertCommandType(input, SortCommand.class);
}

@Test
public void sortCommand_asc_parsedCorrectly() {
final String input = "sort asc";
parseAndAssertCommandType(input, SortCommand.class);
}

@Test
public void sortCommand_desc_parsedCorrectly() {
final String input = "sort desc";
parseAndAssertCommandType(input, SortCommand.class);
}

@Test
public void exitCommand_parsedCorrectly() {
final String input = "exit";
Expand Down Expand Up @@ -141,7 +153,15 @@ public void viewAllCommand_numericArg_indexParsedCorrectly() {
final ViewAllCommand result = parseAndAssertCommandType(input, ViewAllCommand.class);
assertEquals(result.getTargetIndex(), testIndex);
}


@Test
public void sortCommand_wrongArg() {
final String[] inputs = { "sort a", "sort sdfd" };
final String resultMessage =
String.format(MESSAGE_INVALID_COMMAND_FORMAT, SortCommand.MESSAGE_USAGE);
parseAndAssertIncorrectWithMessage(resultMessage, inputs);
}

/**
* Test find persons by keyword in name command
*/
Expand Down