diff --git a/build.gradle b/build.gradle index e5824c45f66..b756e6dc502 100644 --- a/build.gradle +++ b/build.gradle @@ -70,7 +70,7 @@ dependencies { } shadowJar { - archiveFileName = 'addressbook.jar' + archiveFileName = 'ProjectPRO.jar' } defaultTasks 'clean', 'test' diff --git a/src/test/java/seedu/address/logic/commands/DeleteGroupCommandTest.java b/src/test/java/seedu/address/logic/commands/DeleteGroupCommandTest.java index 24ea28f817f..f4679e1d2ff 100644 --- a/src/test/java/seedu/address/logic/commands/DeleteGroupCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/DeleteGroupCommandTest.java @@ -7,11 +7,15 @@ import static seedu.address.logic.commands.DeleteGroupCommand.MESSAGE_DELETE_GROUP_SUCCESS; import static seedu.address.testutil.Assert.assertThrows; import static seedu.address.testutil.TypicalGroups.CS2103; -import static seedu.address.testutil.TypicalPersons.ALICE; + +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.function.Predicate; + +import org.junit.jupiter.api.Test; import javafx.collections.ObservableList; import javafx.util.Pair; -import org.junit.jupiter.api.Test; import seedu.address.commons.core.GuiSettings; import seedu.address.logic.Messages; import seedu.address.logic.commands.exceptions.CommandException; @@ -28,10 +32,6 @@ import seedu.address.testutil.GroupBuilder; import seedu.address.testutil.PersonBuilder; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.function.Predicate; - /** * Contains integration tests (interaction with the Model) and unit tests for * {@code DeleteCommand}. @@ -51,7 +51,6 @@ public void execute_existingGroupWithNoMembers_deleteSuccessful() throws Excepti commandResult.getFeedbackToUser()); ArrayList emptyGroupList = new ArrayList<>(); assertEquals(emptyGroupList, modelStub.groups); // checks group removed from contact list - } @Test @@ -82,24 +81,24 @@ public void execute_nonexistentGroup_throwsCommandException() { Group nonexistentGroup = new GroupBuilder().build(); DeleteGroupCommand deleteGroupCommand = new DeleteGroupCommand(nonexistentGroup.getGroupName()); - DeleteGroupCommandTest.ModelStub modelStub - = new DeleteGroupCommandTest.ModelStubDeletingGroup(); + DeleteGroupCommandTest.ModelStub modelStub = + new DeleteGroupCommandTest.ModelStubDeletingGroup(); - assertThrows(CommandException.class, Messages.MESSAGE_NO_GROUP_WITH_NAME_FOUND, - () -> deleteGroupCommand.execute(modelStub)); + assertThrows(CommandException.class, + Messages.MESSAGE_NO_GROUP_WITH_NAME_FOUND, () -> deleteGroupCommand.execute(modelStub)); // empty input String emptyInput = ""; - assertThrows(CommandException.class, Messages.MESSAGE_NO_GROUP_WITH_NAME_FOUND, - () -> new DeleteGroupCommand(emptyInput).execute(modelStub)); + assertThrows(CommandException.class, + Messages.MESSAGE_NO_GROUP_WITH_NAME_FOUND, () -> new DeleteGroupCommand(emptyInput).execute(modelStub)); } @Test public void equals() { - Group CS2103 = new GroupBuilder().withName("CS2103").build(); - Group CS2103T = new GroupBuilder().withName("CS2103T").build(); - DeleteGroupCommand deleteCS2103Command = new DeleteGroupCommand(CS2103.getGroupName()); - DeleteGroupCommand deleteCS2103TCommand = new DeleteGroupCommand(CS2103T.getGroupName()); + Group cs2103 = new GroupBuilder().withName("CS2103").build(); + Group cs2103T = new GroupBuilder().withName("CS2103T").build(); + DeleteGroupCommand deleteCS2103Command = new DeleteGroupCommand(cs2103.getGroupName()); + DeleteGroupCommand deleteCS2103TCommand = new DeleteGroupCommand(cs2103T.getGroupName()); // same object -> returns true assertTrue(deleteCS2103Command.equals(deleteCS2103Command)); diff --git a/src/test/java/seedu/address/logic/commands/DeletePersonCommandTest.java b/src/test/java/seedu/address/logic/commands/DeletePersonCommandTest.java index 2e4f80cbec3..fb700750dc0 100644 --- a/src/test/java/seedu/address/logic/commands/DeletePersonCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/DeletePersonCommandTest.java @@ -8,9 +8,14 @@ import static seedu.address.testutil.Assert.assertThrows; import static seedu.address.testutil.TypicalPersons.ALICE; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.function.Predicate; + +import org.junit.jupiter.api.Test; + import javafx.collections.ObservableList; import javafx.util.Pair; -import org.junit.jupiter.api.Test; import seedu.address.commons.core.GuiSettings; import seedu.address.logic.Messages; import seedu.address.logic.commands.exceptions.CommandException; @@ -26,10 +31,6 @@ import seedu.address.model.person.Person; import seedu.address.testutil.PersonBuilder; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.function.Predicate; - /** * Contains integration tests (interaction with the Model) and unit tests for * {@code DeleteCommand}. @@ -76,16 +77,16 @@ public void execute_nonexistentPerson_throwsCommandException() { Person nonexistentPerson = new PersonBuilder().build(); DeletePersonCommand deletePersonCommand = new DeletePersonCommand(nonexistentPerson.getName().toString()); - DeletePersonCommandTest.ModelStub modelStub - = new DeletePersonCommandTest.ModelStubDeletingPerson(); + DeletePersonCommandTest.ModelStub modelStub = + new DeletePersonCommandTest.ModelStubDeletingPerson(); - assertThrows(CommandException.class, Messages.MESSAGE_NO_PERSON_WITH_NAME_FOUND, - () -> deletePersonCommand.execute(modelStub)); + assertThrows(CommandException.class, + Messages.MESSAGE_NO_PERSON_WITH_NAME_FOUND, () -> deletePersonCommand.execute(modelStub)); // empty input String emptyInput = ""; - assertThrows(CommandException.class, Messages.MESSAGE_NO_PERSON_WITH_NAME_FOUND, - () -> new DeletePersonCommand(emptyInput).execute(modelStub)); + assertThrows(CommandException.class, Messages.MESSAGE_NO_PERSON_WITH_NAME_FOUND, () -> + new DeletePersonCommand(emptyInput).execute(modelStub)); } @Test diff --git a/src/test/java/seedu/address/logic/commands/FindGroupCommandTest.java b/src/test/java/seedu/address/logic/commands/FindGroupCommandTest.java index ec5485be8f5..577fffedc5b 100644 --- a/src/test/java/seedu/address/logic/commands/FindGroupCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/FindGroupCommandTest.java @@ -6,8 +6,6 @@ import static seedu.address.testutil.Assert.assertThrows; import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook; -import java.util.Arrays; -import java.util.Collections; import java.util.function.Predicate; import org.junit.jupiter.api.Test; @@ -18,7 +16,6 @@ import seedu.address.model.ModelManager; import seedu.address.model.UserPrefs; import seedu.address.model.group.Group; -import seedu.address.model.person.NameContainsKeywordsPredicate; import seedu.address.model.person.Person; import seedu.address.testutil.GroupBuilder; @@ -57,16 +54,14 @@ public void execute_invalidGroup_failure() { // empty input String emptyInput = ""; - assertThrows(CommandException.class, expectedMessage, - () -> new FindGroupCommand(emptyInput).execute(model)); + assertThrows(CommandException.class, expectedMessage, () -> new FindGroupCommand(emptyInput).execute(model)); // nonexistent group Group nonexistentGroup = new GroupBuilder().build(); FindGroupCommand findGroupCommand = new FindGroupCommand(nonexistentGroup.getGroupName()); - assertThrows(CommandException.class, expectedMessage, - () -> findGroupCommand.execute(model)); + assertThrows(CommandException.class, expectedMessage, () -> findGroupCommand.execute(model)); assertEquals(expectedModel.getFilteredPersonList(), model.getFilteredPersonList()); } @@ -92,4 +87,4 @@ public void toStringMethod() { assertEquals(expected, findCS2100Command.toString()); } -} \ No newline at end of file +} diff --git a/src/test/java/seedu/address/logic/commands/ListGroupCommandTest.java b/src/test/java/seedu/address/logic/commands/ListGroupCommandTest.java index 2fd206bb7f3..1f697cb6fb8 100644 --- a/src/test/java/seedu/address/logic/commands/ListGroupCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/ListGroupCommandTest.java @@ -1,13 +1,14 @@ package seedu.address.logic.commands; +import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess; +import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook; + import org.junit.jupiter.api.Test; + import seedu.address.model.Model; import seedu.address.model.ModelManager; import seedu.address.model.UserPrefs; -import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess; -import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook; - public class ListGroupCommandTest { private Model model; private Model expectedModel; diff --git a/src/test/java/seedu/address/logic/parser/DeleteCommandParserTest.java b/src/test/java/seedu/address/logic/parser/DeleteCommandParserTest.java index 57caedda35c..7a2678d4246 100644 --- a/src/test/java/seedu/address/logic/parser/DeleteCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/DeleteCommandParserTest.java @@ -2,9 +2,9 @@ import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.logic.commands.CommandTestUtil.NAME_DESC_AMY; +import static seedu.address.logic.commands.CommandTestUtil.NAME_DESC_BOB; import static seedu.address.logic.commands.CommandTestUtil.NAME_DESC_CS; import static seedu.address.logic.commands.CommandTestUtil.NAME_DESC_CS2103T; -import static seedu.address.logic.commands.CommandTestUtil.NAME_DESC_BOB; import static seedu.address.logic.commands.CommandTestUtil.PREAMBLE_WHITESPACE; import static seedu.address.logic.commands.CommandTestUtil.VALID_GROUP_CS; import static seedu.address.logic.commands.CommandTestUtil.VALID_NAME_AMY; diff --git a/src/test/java/seedu/address/logic/parser/FindCommandParserTest.java b/src/test/java/seedu/address/logic/parser/FindCommandParserTest.java index 020dc485b17..de8f2a93bb4 100644 --- a/src/test/java/seedu/address/logic/parser/FindCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/FindCommandParserTest.java @@ -23,21 +23,21 @@ public class FindCommandParserTest { private FindCommandParser parser = new FindCommandParser(); - private String WHITESPACE = " "; - - private String KEYWORDS_NO_WHITESPACES = WHITESPACE + PREFIX_NAME + "Amy Bob"; - private String KEYWORDS_WITH_WHITESPACES = WHITESPACE + PREFIX_NAME + " \n Amy \n \t Bob \t"; - - private String KEYWORDS_NO_PREFIX = WHITESPACE + "Amy Bob"; + private String whitespace = " "; + private String keywordsWithoutWhitespace = whitespace + PREFIX_NAME + "Amy Bob"; + private String keywordsWithWhitespace = whitespace + PREFIX_NAME + " \n Amy \n \t Bob \t"; + private String keywordsNoPrefix = whitespace + "Amy Bob"; @Test public void parse_validArgs_returnsFindCommand() { // valid command format for find person - assertParseSuccess(parser, PREAMBLE_WHITESPACE + KEYWORDS_NO_WHITESPACES, - new FindPersonCommand(new NameContainsKeywordsPredicate(Arrays.asList("Amy", "Bob")))); // no leading and trailing whitespaces + assertParseSuccess(parser, PREAMBLE_WHITESPACE + keywordsWithoutWhitespace, + new FindPersonCommand(new NameContainsKeywordsPredicate( + Arrays.asList("Amy", "Bob")))); // no leading and trailing whitespaces - assertParseSuccess(parser, PREAMBLE_WHITESPACE + KEYWORDS_WITH_WHITESPACES, - new FindPersonCommand(new NameContainsKeywordsPredicate(Arrays.asList("Amy", "Bob")))); // multiple whitespaces between keywords + assertParseSuccess(parser, PREAMBLE_WHITESPACE + keywordsWithWhitespace, + new FindPersonCommand(new NameContainsKeywordsPredicate( + Arrays.asList("Amy", "Bob")))); // multiple whitespaces between keywords // valid command format for find group assertParseSuccess(parser, NAME_DESC_CS, @@ -51,7 +51,7 @@ public void parse_compulsoryFieldMissingPrefix_failure() { String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_USAGE)); // missing name prefix - assertParseFailure(parser, PREAMBLE_WHITESPACE + KEYWORDS_NO_PREFIX, + assertParseFailure(parser, PREAMBLE_WHITESPACE + keywordsNoPrefix, String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_USAGE)); // missing group prefix @@ -62,7 +62,7 @@ public void parse_compulsoryFieldMissingPrefix_failure() { @Test public void parse_repeatedNonTagValue_failure() { // multiple name prefixes - assertParseFailure(parser, PREAMBLE_WHITESPACE + KEYWORDS_NO_WHITESPACES + KEYWORDS_WITH_WHITESPACES, + assertParseFailure(parser, PREAMBLE_WHITESPACE + keywordsWithoutWhitespace + keywordsWithWhitespace, Messages.getErrorMessageForDuplicatePrefixes(PREFIX_NAME)); // multiple group prefixes @@ -70,20 +70,19 @@ public void parse_repeatedNonTagValue_failure() { Messages.getErrorMessageForDuplicatePrefixes(PREFIX_GROUPTAG)); //multiple name and group prefixes - assertParseFailure(parser, PREAMBLE_WHITESPACE + KEYWORDS_NO_WHITESPACES + KEYWORDS_WITH_WHITESPACES + assertParseFailure(parser, PREAMBLE_WHITESPACE + keywordsWithoutWhitespace + keywordsWithWhitespace + NAME_DESC_CS + NAME_DESC_CS2103T, Messages.getErrorMessageForDuplicatePrefixes(PREFIX_NAME, PREFIX_GROUPTAG)); // name and group - assertParseFailure(parser, PREAMBLE_WHITESPACE + KEYWORDS_NO_WHITESPACES + NAME_DESC_CS, + assertParseFailure(parser, PREAMBLE_WHITESPACE + keywordsWithoutWhitespace + NAME_DESC_CS, String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_TWO_PARAMETERS)); } @Test public void parse_invalidValue_failure() { // empty name for find person command - assertParseFailure(parser, PREAMBLE_WHITESPACE + WHITESPACE + PREFIX_NAME, + assertParseFailure(parser, PREAMBLE_WHITESPACE + whitespace + PREFIX_NAME, FindCommand.MESSAGE_EMPTY_NAME); } - -} \ No newline at end of file +}