From 1b12da0b7b4c77a2111823a69f807383352a7740 Mon Sep 17 00:00:00 2001 From: Dhiraputta Pathama Tengara Date: Thu, 21 Mar 2024 23:47:33 +0800 Subject: [PATCH 1/4] Fix AddCommand and modify Person --- .../address/logic/commands/AddCommand.java | 9 ++-- .../address/logic/commands/EditCommand.java | 4 +- .../address/logic/commands/TagCommand.java | 2 +- .../logic/parser/AddCommandParser.java | 24 ++++++----- .../seedu/address/model/person/Person.java | 24 +++++------ .../address/model/util/SampleDataUtil.java | 12 +++--- .../address/storage/JsonAdaptedPerson.java | 2 +- .../logic/commands/EditCommandTest.java | 2 +- .../logic/parser/AddCommandParserTest.java | 41 ++++++++----------- .../address/model/person/PersonTest.java | 2 +- .../seedu/address/testutil/PersonBuilder.java | 4 +- 11 files changed, 62 insertions(+), 64 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/AddCommand.java b/src/main/java/seedu/address/logic/commands/AddCommand.java index 16695c18a27..9341daaedf5 100644 --- a/src/main/java/seedu/address/logic/commands/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddCommand.java @@ -5,6 +5,7 @@ import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; +import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; import static seedu.address.logic.parser.CliSyntax.PREFIX_YEAR_JOINED; import seedu.address.commons.util.ToStringBuilder; @@ -22,21 +23,23 @@ public class AddCommand extends Command { public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds an employee to the address book.\n" + "Format:\n" - + "• " + COMMAND_WORD + " NAME, PHONE, EMAIL, ADDRESS, YEAR_JOINED\n" + + "• " + COMMAND_WORD + " NAME; PHONE; EMAIL; ADDRESS; YEAR_JOINED; [TAG]...\n" + "• " + COMMAND_WORD + " " + PREFIX_NAME + " NAME " + PREFIX_PHONE + " PHONE " + PREFIX_EMAIL + " EMAIL " + PREFIX_ADDRESS + " ADDRESS" + PREFIX_YEAR_JOINED + " YEAR_JOINED\n" + + "[" + PREFIX_TAG + " TAG]...\n" + "Examples:\n" - + "• " + COMMAND_WORD + " John Doe, 98765432, johnd@example.com, Street A, 2024\n" + + "• " + COMMAND_WORD + " John Doe; 98765432; johnd@example.com; Street A; 2024; Software Developer\n" + "• " + COMMAND_WORD + " " + PREFIX_NAME + " John Doe " + PREFIX_PHONE + " 98765432 " + PREFIX_EMAIL + " johnd@example.com " + PREFIX_ADDRESS + " Street A" - + PREFIX_YEAR_JOINED + " 2024"; + + PREFIX_YEAR_JOINED + " 2024" + + PREFIX_TAG + " Software Developer"; public static final String MESSAGE_SUCCESS = "New employee added: %1$s"; public static final String MESSAGE_DUPLICATE_PERSON = "This employee already exists in the address book"; diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 7bbb304a6a9..a3c8dc04e4e 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -40,7 +40,7 @@ public class EditCommand extends Command { public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the person identified " + "by the id number provided.\n" + "Existing values will be overwritten by the input values.\n" - + "Parameters: ID (must be a positive 6-gidit number) " + + "Parameters: ID (must be a positive 6-digit number) " + "[" + PREFIX_NAME + "NAME] " + "[" + PREFIX_PHONE + "PHONE] " + "[" + PREFIX_EMAIL + "EMAIL] " @@ -107,7 +107,7 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); Set updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags()); - return new Person(id, updatedName, updatedPhone, updatedEmail, yearJoined, updatedAddress, updatedTags); + return new Person(id, updatedName, updatedPhone, updatedEmail, updatedAddress, yearJoined, updatedTags); } @Override diff --git a/src/main/java/seedu/address/logic/commands/TagCommand.java b/src/main/java/seedu/address/logic/commands/TagCommand.java index ad275fa7350..24d2d87bba0 100644 --- a/src/main/java/seedu/address/logic/commands/TagCommand.java +++ b/src/main/java/seedu/address/logic/commands/TagCommand.java @@ -97,7 +97,7 @@ private Person addTagsToPerson(Person personToTag, Set tagsToAdd) throws Co throw new CommandException(MESSAGE_DUPLICATE_TAGS); } - Person editedPerson = new Person(id, name, phone, email, yearJoined, address, tagsToAdd); + Person editedPerson = new Person(id, name, phone, email, address, yearJoined, tagsToAdd); return editedPerson; } diff --git a/src/main/java/seedu/address/logic/parser/AddCommandParser.java b/src/main/java/seedu/address/logic/parser/AddCommandParser.java index fe731f2d31d..f703d943508 100644 --- a/src/main/java/seedu/address/logic/parser/AddCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/AddCommandParser.java @@ -43,20 +43,21 @@ public AddCommandParser(Model model) { * @throws ParseException if the user input does not conform the expected format */ public AddCommand parse(String args) throws ParseException { - if (args.equals("\\w+(,\\s+\\w+){2:}")) { - args = appendPrefixes(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_YEAR_JOINED); + if (args.matches("\\s+[^;].*(?:;\\s+[^;].*){3,}")) { + args = appendPrefixes(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, + PREFIX_YEAR_JOINED, PREFIX_TAG); } ArgumentMultimap argMultimap = - ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_YEAR_JOINED, - PREFIX_ADDRESS, PREFIX_TAG); + ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, + PREFIX_YEAR_JOINED, PREFIX_TAG); - if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL) + if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS) || !argMultimap.getPreamble().isEmpty()) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE)); } - argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS); + argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL); Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get()); Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get()); Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get()); @@ -64,7 +65,7 @@ public AddCommand parse(String args) throws ParseException { Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get()); Set tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG)); - Person person = new Person(model, name, phone, email, yearJoined, address, tagList); + Person person = new Person(model, name, phone, email, address, yearJoined, tagList); return new AddCommand(person); } @@ -84,11 +85,12 @@ private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Pre * @return the {@code String} of arguments with the prefixes appended */ private static String appendPrefixes(String args, Prefix... prefixes) { - String[] argsArr = args.split(",\\s+"); - for (int i = 0; i < prefixes.length && i < argsArr.length; i++) { - argsArr[i] = prefixes[i] + argsArr[i]; + StringBuilder result = new StringBuilder(); + String[] argsArr = args.trim().split(";\\s+"); + for (int i = 0; i < Math.min(prefixes.length, argsArr.length); i++) { + result.append(" ").append(prefixes[i]).append(" ").append(argsArr[i]); } - return String.join(" ", argsArr); + return result.toString(); } } diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/seedu/address/model/person/Person.java index 574920c4c79..1497ed72e12 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/seedu/address/model/person/Person.java @@ -31,29 +31,29 @@ public class Person { /** * Every field must be present and not null. */ - public Person(Model model, Name name, Phone phone, Email email, YearJoined yearJoined, - Address address, Set tags) { - requireAllNonNull(model, name, phone, email, yearJoined, address, tags); + public Person(Model model, Name name, Phone phone, Email email, Address address, + YearJoined yearJoined, Set tags) { + requireAllNonNull(model, name, phone, email, address, yearJoined, tags); this.id = new Id(model, yearJoined); this.name = name; this.phone = phone; this.email = email; - this.yearJoined = yearJoined; this.address = address; + this.yearJoined = yearJoined; this.tags.addAll(tags); } /** * Every field must be present and not null. */ - public Person(Id id, Name name, Phone phone, Email email, YearJoined yearJoined, Address address, Set tags) { - requireAllNonNull(id, name, phone, email, address, tags); + public Person(Id id, Name name, Phone phone, Email email, Address address, YearJoined yearJoined, Set tags) { + requireAllNonNull(id, name, phone, email, address, yearJoined, tags); this.id = id; this.name = name; this.phone = phone; this.email = email; - this.yearJoined = yearJoined; this.address = address; + this.yearJoined = yearJoined; this.tags.addAll(tags); } @@ -118,19 +118,19 @@ public boolean equals(Object other) { } Person otherPerson = (Person) other; - return name.equals(otherPerson.name) - && id.equals(otherPerson.id) + return id.equals(otherPerson.id) + && name.equals(otherPerson.name) && phone.equals(otherPerson.phone) && email.equals(otherPerson.email) - && yearJoined.equals(otherPerson.yearJoined) && address.equals(otherPerson.address) + && yearJoined.equals(otherPerson.yearJoined) && tags.equals(otherPerson.tags); } @Override public int hashCode() { // use this method for custom fields hashing instead of implementing your own - return Objects.hash(name, phone, email, yearJoined, address, tags); + return Objects.hash(name, phone, email, address, yearJoined, tags); } @Override @@ -140,8 +140,8 @@ public String toString() { .add("name", name) .add("phone", phone) .add("email", email) - .add("year joined", yearJoined) .add("address", address) + .add("year joined", yearJoined) .add("tags", tags) .toString(); } diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 2dae17f9c59..efa07a4a961 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -23,33 +23,33 @@ public static Person[] getSamplePersons() { return new Person[] { new Person(new Id(240001), new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), - new YearJoined("2024"), new Address("Blk 30 Geylang Street 29, #06-40"), + new YearJoined("2024"), getTagSet("friends")), new Person(new Id(240002), new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), - new YearJoined("2024"), new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), + new YearJoined("2024"), getTagSet("colleagues", "friends")), new Person(new Id(240003), new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), - new YearJoined("2024"), new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), + new YearJoined("2024"), getTagSet("neighbours")), new Person(new Id(240004), new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), - new YearJoined("2024"), new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), + new YearJoined("2024"), getTagSet("family")), new Person(new Id(240005), new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), - new YearJoined("2024"), new Address("Blk 47 Tampines Street 20, #17-35"), + new YearJoined("2024"), getTagSet("classmates")), new Person(new Id(240006), new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), - new YearJoined("2024"), new Address("Blk 45 Aljunied Street 85, #11-31"), + new YearJoined("2024"), getTagSet("colleagues")) }; } diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java index 9ecf7647c53..83c4f6ee589 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java @@ -118,7 +118,7 @@ public Person toModelType() throws IllegalValueException { final Address modelAddress = new Address(address); final Set modelTags = new HashSet<>(personTags); - return new Person(modelId, modelName, modelPhone, modelEmail, modelYearJoined, modelAddress, modelTags); + return new Person(modelId, modelName, modelPhone, modelEmail, modelAddress, modelYearJoined, modelTags); } } diff --git a/src/test/java/seedu/address/logic/commands/EditCommandTest.java b/src/test/java/seedu/address/logic/commands/EditCommandTest.java index 39ac10b77fd..66f4ef4bde0 100644 --- a/src/test/java/seedu/address/logic/commands/EditCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/EditCommandTest.java @@ -95,7 +95,7 @@ public void execute_filteredList_success() { @Test public void execute_duplicatePersonUnfilteredList_failure() { Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()); - System.out.println(firstPerson); + EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder(firstPerson).withName("Benson Meier").build(); EditCommand editCommand = new EditCommand( model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased()).getId(), descriptor); diff --git a/src/test/java/seedu/address/logic/parser/AddCommandParserTest.java b/src/test/java/seedu/address/logic/parser/AddCommandParserTest.java index 7a731641593..cfa5daab633 100644 --- a/src/test/java/seedu/address/logic/parser/AddCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddCommandParserTest.java @@ -25,7 +25,6 @@ import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_FRIEND; import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_HUSBAND; import static seedu.address.logic.commands.CommandTestUtil.YEARJOINED_DESC_BOB; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; @@ -56,22 +55,22 @@ public void parse_allFieldsPresent_success() { // whitespace only preamble assertParseSuccess(parser, PREAMBLE_WHITESPACE + NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB - + YEARJOINED_DESC_BOB + ADDRESS_DESC_BOB + TAG_DESC_FRIEND, new AddCommand(expectedPerson)); + + ADDRESS_DESC_BOB + YEARJOINED_DESC_BOB + TAG_DESC_FRIEND, new AddCommand(expectedPerson)); // multiple tags - all accepted Person expectedPersonMultipleTags = new PersonBuilder(BOB).withTags(VALID_TAG_FRIEND, VALID_TAG_HUSBAND) .build(); assertParseSuccess(parser, - NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + YEARJOINED_DESC_BOB - + ADDRESS_DESC_BOB + TAG_DESC_HUSBAND + TAG_DESC_FRIEND, + NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + ADDRESS_DESC_BOB + YEARJOINED_DESC_BOB + + TAG_DESC_HUSBAND + TAG_DESC_FRIEND, new AddCommand(expectedPersonMultipleTags)); } @Test public void parse_repeatedNonTagValue_failure() { - String validExpectedPersonString = NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + YEARJOINED_DESC_BOB - + ADDRESS_DESC_BOB + YEARJOINED_DESC_BOB + TAG_DESC_FRIEND; + String validExpectedPersonString = NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + ADDRESS_DESC_BOB + + YEARJOINED_DESC_BOB + YEARJOINED_DESC_BOB + TAG_DESC_FRIEND; // multiple names assertParseFailure(parser, NAME_DESC_AMY + validExpectedPersonString, @@ -84,9 +83,9 @@ public void parse_repeatedNonTagValue_failure() { Messages.getErrorMessageForDuplicatePrefixes(PREFIX_EMAIL)); // multiple fields repeated assertParseFailure(parser, - validExpectedPersonString + PHONE_DESC_AMY + EMAIL_DESC_AMY + NAME_DESC_AMY + ADDRESS_DESC_AMY + validExpectedPersonString + PHONE_DESC_AMY + EMAIL_DESC_AMY + NAME_DESC_AMY + validExpectedPersonString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_NAME, PREFIX_ADDRESS, PREFIX_EMAIL, PREFIX_PHONE)); + Messages.getErrorMessageForDuplicatePrefixes(PREFIX_NAME, PREFIX_EMAIL, PREFIX_PHONE)); // invalid value followed by valid value // invalid name assertParseFailure(parser, INVALID_NAME_DESC + validExpectedPersonString, @@ -97,9 +96,6 @@ public void parse_repeatedNonTagValue_failure() { // invalid phone assertParseFailure(parser, INVALID_PHONE_DESC + validExpectedPersonString, Messages.getErrorMessageForDuplicatePrefixes(PREFIX_PHONE)); - // invalid address - assertParseFailure(parser, INVALID_ADDRESS_DESC + validExpectedPersonString, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_ADDRESS)); // valid value followed by invalid value // invalid name assertParseFailure(parser, validExpectedPersonString + INVALID_NAME_DESC, @@ -110,17 +106,14 @@ public void parse_repeatedNonTagValue_failure() { // invalid phone assertParseFailure(parser, validExpectedPersonString + INVALID_PHONE_DESC, Messages.getErrorMessageForDuplicatePrefixes(PREFIX_PHONE)); - // invalid address - assertParseFailure(parser, validExpectedPersonString + INVALID_ADDRESS_DESC, - Messages.getErrorMessageForDuplicatePrefixes(PREFIX_ADDRESS)); } @Test public void parse_optionalFieldsMissing_success() { // zero tags Person expectedPerson = new PersonBuilder(AMY).withTags().build(); - assertParseSuccess(parser, NAME_DESC_AMY + PHONE_DESC_AMY + EMAIL_DESC_AMY + YEARJOINED_DESC_BOB - + ADDRESS_DESC_AMY, + assertParseSuccess(parser, NAME_DESC_AMY + PHONE_DESC_AMY + EMAIL_DESC_AMY + ADDRESS_DESC_AMY + + YEARJOINED_DESC_BOB, new AddCommand(expectedPerson)); } @@ -164,20 +157,20 @@ public void parse_invalidValue_failure() { + TAG_DESC_HUSBAND + TAG_DESC_FRIEND, Email.MESSAGE_CONSTRAINTS); // invalid address - assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + YEARJOINED_DESC_BOB - + INVALID_ADDRESS_DESC + TAG_DESC_HUSBAND + TAG_DESC_FRIEND, Address.MESSAGE_CONSTRAINTS); + assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + INVALID_ADDRESS_DESC + + YEARJOINED_DESC_BOB + TAG_DESC_HUSBAND + TAG_DESC_FRIEND, Address.MESSAGE_CONSTRAINTS); // invalid tag - assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + YEARJOINED_DESC_BOB - + ADDRESS_DESC_BOB + INVALID_TAG_DESC + VALID_TAG_FRIEND, Tag.MESSAGE_CONSTRAINTS); + assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + ADDRESS_DESC_BOB + + YEARJOINED_DESC_BOB + INVALID_TAG_DESC + VALID_TAG_FRIEND, Tag.MESSAGE_CONSTRAINTS); // invalid tag - assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + YEARJOINED_DESC_BOB - + ADDRESS_DESC_BOB + INVALID_TAG_DESC + VALID_TAG_FRIEND, Tag.MESSAGE_CONSTRAINTS); + assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + ADDRESS_DESC_BOB + + YEARJOINED_DESC_BOB + INVALID_TAG_DESC + VALID_TAG_FRIEND, Tag.MESSAGE_CONSTRAINTS); // two invalid values, only first invalid value reported - assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + YEARJOINED_DESC_BOB - + ADDRESS_DESC_BOB + INVALID_TAG_DESC + VALID_TAG_FRIEND, Tag.MESSAGE_CONSTRAINTS); + assertParseFailure(parser, NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB + ADDRESS_DESC_BOB + + YEARJOINED_DESC_BOB + INVALID_TAG_DESC + VALID_TAG_FRIEND, Tag.MESSAGE_CONSTRAINTS); // non-empty preamble assertParseFailure(parser, PREAMBLE_NON_EMPTY + NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB diff --git a/src/test/java/seedu/address/model/person/PersonTest.java b/src/test/java/seedu/address/model/person/PersonTest.java index 6351f6806ef..e5994944ade 100644 --- a/src/test/java/seedu/address/model/person/PersonTest.java +++ b/src/test/java/seedu/address/model/person/PersonTest.java @@ -94,7 +94,7 @@ public void equals() { public void toStringMethod() { String expected = Person.class.getCanonicalName() + "{id=" + ALICE.getId() + ", name=" + ALICE.getName() + ", phone=" + ALICE.getPhone() + ", email=" + ALICE.getEmail() - + ", year joined=" + ALICE.getYearJoined() + ", address=" + ALICE.getAddress() + + ", address=" + ALICE.getAddress() + ", year joined=" + ALICE.getYearJoined() + ", tags=" + ALICE.getTags() + "}"; assertEquals(expected, ALICE.toString()); } diff --git a/src/test/java/seedu/address/testutil/PersonBuilder.java b/src/test/java/seedu/address/testutil/PersonBuilder.java index 2f5d77f5f52..05a1d799f32 100644 --- a/src/test/java/seedu/address/testutil/PersonBuilder.java +++ b/src/test/java/seedu/address/testutil/PersonBuilder.java @@ -54,8 +54,8 @@ public PersonBuilder(Person personToCopy) { name = personToCopy.getName(); phone = personToCopy.getPhone(); email = personToCopy.getEmail(); - yearJoined = personToCopy.getYearJoined(); address = personToCopy.getAddress(); + yearJoined = personToCopy.getYearJoined(); tags = new HashSet<>(personToCopy.getTags()); } @@ -116,7 +116,7 @@ public PersonBuilder withId(Integer id) { } public Person build() { - return new Person(id, name, phone, email, yearJoined, address, tags); + return new Person(id, name, phone, email, address, yearJoined, tags); } /** From 17aaf9941288c9983bd2bb2d6e424696e4f0c24c Mon Sep 17 00:00:00 2001 From: Dhiraputta Pathama Tengara Date: Thu, 21 Mar 2024 23:50:47 +0800 Subject: [PATCH 2/4] Rename addressbook.json to payback.json --- docs/tutorials/AddRemark.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/AddRemark.md b/docs/tutorials/AddRemark.md index d98f38982e7..aaa0a7e3cd6 100644 --- a/docs/tutorials/AddRemark.md +++ b/docs/tutorials/AddRemark.md @@ -293,7 +293,7 @@ While the changes to code may be minimal, the test data will have to be updated
-:exclamation: You must delete AddressBook’s storage file located at `/data/addressbook.json` before running it! Not doing so will cause AddressBook to default to an empty address book! +:exclamation: You must delete AddressBook’s storage file located at `/data/payback.json` before running it! Not doing so will cause AddressBook to default to an empty address book!
From 634f98bf5b15484c03c3a10a73ee7869373815fc Mon Sep 17 00:00:00 2001 From: Dhiraputta Pathama Tengara Date: Thu, 21 Mar 2024 23:54:23 +0800 Subject: [PATCH 3/4] Update UserGuide.md --- docs/UserGuide.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index de43762c2a2..aa6ab1a9ed2 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -73,11 +73,11 @@ Format: `help` Adds a new employee to the address book. Format: -* `/add NAME, PHONE, EMAIL, ADDRESS, YEAR_JOINED` -* `/add :name NAME :phone PHONE :email EMAIL :address ADDRESS :year YEAR_JOINED` +* `/add NAME; PHONE; EMAIL; ADDRESS; YEAR_JOINED; [TAG]…` +* `/add :name NAME :phone PHONE :email EMAIL :address ADDRESS :year YEAR_JOINED [:tag TAG]…` Examples: -* `/add John Doe, 98765432, johndoe@example.com, street A, 2024` +* `/add John Doe; 98765432; johndoe@example.com; street A; 2024; finance manager` * `/add :name John Doe :phone 98765432 :email johndoe@example.com :address street A :year 2024` ### Listing all persons : `/list` From 00c1ba465d19ae15e004511de6c3a64834160d3e Mon Sep 17 00:00:00 2001 From: Dhiraputta Pathama Tengara Date: Fri, 22 Mar 2024 00:31:40 +0800 Subject: [PATCH 4/4] Update BetterModelClassDiagram.puml --- docs/diagrams/BetterModelClassDiagram.puml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/diagrams/BetterModelClassDiagram.puml b/docs/diagrams/BetterModelClassDiagram.puml index 598474a5c82..39392ca0f35 100644 --- a/docs/diagrams/BetterModelClassDiagram.puml +++ b/docs/diagrams/BetterModelClassDiagram.puml @@ -18,4 +18,5 @@ Person *--> Name Person *--> Phone Person *--> Email Person *--> Address +Person *--> YearJoined @enduml