forked from AY2324S1-CS2103-F13-2/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
3213b3a
commit 3c31062
Showing
7 changed files
with
110 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
32 changes: 32 additions & 0 deletions
32
src/test/java/seedu/address/logic/commands/SortCommandTest.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,32 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; | ||
import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure; | ||
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess; | ||
import static seedu.address.testutil.TypicalPersons.ALICE; | ||
import static seedu.address.testutil.TypicalPersons.BENSON; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.model.Model; | ||
import seedu.address.model.ModelManager; | ||
|
||
public class SortCommandTest { | ||
private Model model = new ModelManager(); | ||
private Model reversed = new ModelManager(); | ||
|
||
@Test | ||
public void execute_success() { | ||
model.addPerson(ALICE); | ||
model.addPerson(BENSON); | ||
reversed.addPerson(BENSON); | ||
reversed.addPerson(ALICE); | ||
assertCommandSuccess(new SortCommand("name", true), model, SortCommand.MESSAGE_SUCCESS, reversed); | ||
assertCommandSuccess(new SortCommand("name"), model, SortCommand.MESSAGE_SUCCESS, model); | ||
} | ||
|
||
@Test | ||
public void execute_failure() { | ||
|
||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/seedu/address/logic/parser/SortCommandParserTest.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,28 @@ | ||
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 org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.logic.commands.SortCommand; | ||
import seedu.address.logic.parser.exceptions.ParseException; | ||
|
||
class SortCommandParserTest { | ||
|
||
private SortCommandParser parser = new SortCommandParser(); | ||
|
||
@Test | ||
void parse_success() throws ParseException { | ||
assertParseSuccess(parser, " name", new SortCommand("name")); | ||
assertParseSuccess(parser, " name desc", new SortCommand("name", true)); | ||
} | ||
|
||
@Test | ||
void parse_failure() { | ||
assertParseFailure(parser, " ", String.format(MESSAGE_INVALID_COMMAND_FORMAT, SortCommand.MESSAGE_USAGE)); | ||
assertParseFailure(parser, " a b c ", String.format(MESSAGE_INVALID_COMMAND_FORMAT, SortCommand.MESSAGE_USAGE)); | ||
assertParseFailure(parser, " a b ", String.format(MESSAGE_INVALID_COMMAND_FORMAT, SortCommand.MESSAGE_USAGE)); | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package seedu.address.model.person; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static seedu.address.testutil.Assert.assertThrows; | ||
|
@@ -85,4 +86,11 @@ public void equals() { | |
// different values -> returns false | ||
assertFalse(email.equals(new Email("other.valid@email"))); | ||
} | ||
|
||
@Test | ||
public void compareTo() { | ||
assertEquals(new Email("[email protected]").compareTo(new Email("[email protected]")), -1); | ||
assertEquals(new Email("[email protected]").compareTo(new Email("[email protected]")), 0); | ||
assertEquals(new Email("[email protected]").compareTo(new Email("[email protected]")), 1); | ||
} | ||
} |
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
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