diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc index 3d022f191b98..f1fb2bcdcd6f 100644 --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -210,6 +210,34 @@ Selects the 2nd person in the address book. `select 1` + Selects the 1st person in the results of the `find` command. +=== Favouriting a person : `favourite` + +Favourites the person identified by the index number used in the last person listing. + +If person identified is already a favourite, the person is no longer a favourite. +Format: `favourite INDEX` + +**** +* Changes the font colour of the person's name at the specified `INDEX` to red. +* Shifts the person up to the top of the list. +* The index refers to the index number shown in the most recent listing. +* The index *must be a positive integer* `1, 2, 3, ...` +**** + +Examples: + +* `list` + +`favourite 2` + +Favourites the 2nd person in the address book. +* `find Betsy` + +`favourite 1` + +Favourites the 1st person in the results of the `find` command. +* `list` + +`favourite 1` + +Favourites the 1st person in the address book. + +`favourite 1` + +Unfavourite the 1st person in the address book. + + === Listing entered commands : `history` Lists all the commands that you have entered in reverse chronological order. + diff --git a/src/main/java/seedu/address/logic/commands/DeleteAltCommand.java b/src/main/java/seedu/address/logic/commands/DeleteAltCommand.java index 46f506623aba..1c52e7cf353f 100644 --- a/src/main/java/seedu/address/logic/commands/DeleteAltCommand.java +++ b/src/main/java/seedu/address/logic/commands/DeleteAltCommand.java @@ -10,7 +10,7 @@ import seedu.address.model.person.exceptions.PersonNotFoundException; /** - * Deletes a person identified using it's last displayed index from the address book. + * Deletes a person identified using its last displayed index from the address book. */ public class DeleteAltCommand extends UndoableCommand { diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 0365acbc488b..1702a688a024 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -101,8 +101,9 @@ private static Person createEditedPerson(ReadOnlyPerson personToEdit, Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail()); Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); Set updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags()); + boolean originalFavourite = personToEdit.getFavourite(); - return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedTags); + return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedTags, originalFavourite); } @Override diff --git a/src/main/java/seedu/address/logic/commands/FavouriteCommand.java b/src/main/java/seedu/address/logic/commands/FavouriteCommand.java new file mode 100644 index 000000000000..e632549c709e --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/FavouriteCommand.java @@ -0,0 +1,114 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; +import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; + +import java.util.List; +import java.util.Set; + +import seedu.address.commons.core.Messages; +import seedu.address.commons.core.index.Index; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.person.Address; +import seedu.address.model.person.Email; +import seedu.address.model.person.Name; +import seedu.address.model.person.Person; +import seedu.address.model.person.Phone; +import seedu.address.model.person.ReadOnlyPerson; +import seedu.address.model.person.exceptions.DuplicatePersonException; +import seedu.address.model.person.exceptions.PersonNotFoundException; +import seedu.address.model.tag.Tag; + +/** + * Favourites an exisiting contact + */ +public class FavouriteCommand extends UndoableCommand { + + public static final String COMMAND_WORD = "favourite"; + public static final String COMMAND_ALIAS = "fav"; + + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to your favourite contacts " + + "by the index number used in the last person listing.\n" + + "Parameters: INDEX (must be a positive integer)\n" + + "Example: " + COMMAND_WORD + " 1 "; + + public static final String MESSAGE_FAVOURITE_PERSON_SUCCESS = "Added person to favourites: %1$s"; + public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book."; + public static final String MESSAGE_UNFAVOURITE_PERSON_SUCCESS = "Person removed from favourites: "; + + private final Index index; + + + /** + * @param index of the person in the filtered person list to edit + */ + public FavouriteCommand(Index index) { + requireNonNull(index); + + this.index = index; + } + + @Override + public CommandResult executeUndoableCommand() throws CommandException { + List lastShownList = model.getFilteredPersonList(); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + } + + ReadOnlyPerson personToFavourite = lastShownList.get(index.getZeroBased()); + + Person favouritedPerson = createFavouritedPerson(personToFavourite); + + try { + model.favouritePerson(personToFavourite, favouritedPerson); + } catch (DuplicatePersonException dpe) { + throw new CommandException(MESSAGE_DUPLICATE_PERSON); + } catch (PersonNotFoundException pnfe) { + throw new AssertionError("The target person cannot be missing"); + } + model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + + if (personToFavourite.getFavourite()) { + return new CommandResult(String.format(MESSAGE_UNFAVOURITE_PERSON_SUCCESS, favouritedPerson)); + } else { + return new CommandResult(String.format(MESSAGE_FAVOURITE_PERSON_SUCCESS, favouritedPerson)); + } + + } + + /** + * Creates and returns a {@code Person} with the details of {@code personToFavourite} + */ + private static Person createFavouritedPerson(ReadOnlyPerson personToFavourite) { + assert personToFavourite != null; + + Name originalName = personToFavourite.getName(); + Phone originalPhone = personToFavourite.getPhone(); + Email originalEmail = personToFavourite.getEmail(); + Address originalAddress = personToFavourite.getAddress(); + Set originalTags = personToFavourite.getTags(); + boolean newFavourite = !personToFavourite.getFavourite(); + + return new Person(originalName, originalPhone, originalEmail, originalAddress, + originalTags, newFavourite); + } + + @Override + public boolean equals(Object other) { + // short circuit if same object + if (other == this) { + return true; + } + + // instanceof handles nulls + if (!(other instanceof FavouriteCommand)) { + return false; + } + + // state check + FavouriteCommand e = (FavouriteCommand) other; + return index.equals(e.index); + } + +} diff --git a/src/main/java/seedu/address/logic/parser/AddCommandParser.java b/src/main/java/seedu/address/logic/parser/AddCommandParser.java index 670abf84e164..5aa0fae3c935 100644 --- a/src/main/java/seedu/address/logic/parser/AddCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/AddCommandParser.java @@ -45,8 +45,9 @@ public AddCommand parse(String args) throws ParseException { Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL)).get(); Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS)).get(); Set tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG)); + boolean favourite = false; - ReadOnlyPerson person = new Person(name, phone, email, address, tagList); + ReadOnlyPerson person = new Person(name, phone, email, address, tagList, favourite); return new AddCommand(person); } catch (IllegalValueException ive) { diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index d0c24619500f..a6b1a3cd3c37 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -14,6 +14,7 @@ import seedu.address.logic.commands.DeleteCommand; import seedu.address.logic.commands.EditCommand; import seedu.address.logic.commands.ExitCommand; +import seedu.address.logic.commands.FavouriteCommand; import seedu.address.logic.commands.FindCommand; import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.HistoryCommand; @@ -116,6 +117,10 @@ public Command parseCommand(String userInput) throws ParseException { case RedoCommand.COMMAND_ALIAS: return new RedoCommand(); + case FavouriteCommand.COMMAND_WORD: + case FavouriteCommand.COMMAND_ALIAS: + return new FavouriteCommandParser().parse(arguments); + case SortCommand.COMMAND_WORD: return new SortCommandParser().parse(arguments); diff --git a/src/main/java/seedu/address/logic/parser/FavouriteCommandParser.java b/src/main/java/seedu/address/logic/parser/FavouriteCommandParser.java new file mode 100644 index 000000000000..c9958a55c71a --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/FavouriteCommandParser.java @@ -0,0 +1,30 @@ +package seedu.address.logic.parser; + +import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; + +import seedu.address.commons.core.index.Index; +import seedu.address.commons.exceptions.IllegalValueException; +import seedu.address.logic.commands.FavouriteCommand; +import seedu.address.logic.parser.exceptions.ParseException; + +/** + * Parses input arguments and creates a new DeleteCommand object + */ +public class FavouriteCommandParser implements Parser { + + /** + * Parses the given {@code String} of arguments in the context of the FavouriteCommand + * and returns an FavouriteCommand object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + public FavouriteCommand parse(String args) throws ParseException { + try { + Index index = ParserUtil.parseIndex(args); + return new FavouriteCommand(index); + } catch (IllegalValueException ive) { + throw new ParseException( + String.format(MESSAGE_INVALID_COMMAND_FORMAT, FavouriteCommand.MESSAGE_USAGE)); + } + } + +} diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/seedu/address/model/AddressBook.java index 7de42604c222..2de6d680fe06 100644 --- a/src/main/java/seedu/address/model/AddressBook.java +++ b/src/main/java/seedu/address/model/AddressBook.java @@ -108,13 +108,49 @@ public void updatePerson(ReadOnlyPerson target, ReadOnlyPerson editedReadOnlyPer requireNonNull(editedReadOnlyPerson); Person editedPerson = new Person(editedReadOnlyPerson); + syncMasterTagListWith(editedPerson); // TODO: the tags master list will be updated even though the below line fails. // This can cause the tags master list to have additional tags that are not tagged to any person // in the person list. persons.setPerson(target, editedPerson); + } + /** + * Replaces the given person {@code target} in the list with {@code favouritedReadOnlyPerson}. + * Sorts the list to show favourite contacts first. + * {@code AddressBook}'s tag list will be updated with the tags of {@code favouritedReadOnlyPerson}. + * + * @throws PersonNotFoundException if {@code target} could not be found in the list. + * + * @see #syncMasterTagListWith(Person) + */ + public void favouritePerson(ReadOnlyPerson target, ReadOnlyPerson favouritedReadOnlyPerson) + throws DuplicatePersonException, PersonNotFoundException { + requireNonNull(favouritedReadOnlyPerson); + + Person favouritedPerson = new Person(favouritedReadOnlyPerson); + syncMasterTagListWith(favouritedPerson); + // TODO: the tags master list will be updated even though the below line fails. + // This can cause the tags master list to have additional tags that are not tagged to any person + // in the person list. + persons.setPerson(target, favouritedPerson); + + UniquePersonList notFavouriteList = new UniquePersonList(); + UniquePersonList favouriteList = new UniquePersonList(); + for (ReadOnlyPerson person : persons) { + if (person.getFavourite()) { + favouriteList.add(person); + } else { + notFavouriteList.add(person); + } + } + persons.setPersons(favouriteList); + for (ReadOnlyPerson person : notFavouriteList) { + persons.add(person); + } + } /** * Ensures that every tag in this person: * - exists in the master list {@link #tags} diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/seedu/address/model/Model.java index 9ee751d728a3..03ff4f9cde1b 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/seedu/address/model/Model.java @@ -40,6 +40,9 @@ public interface Model { void updatePerson(ReadOnlyPerson target, ReadOnlyPerson editedPerson) throws DuplicatePersonException, PersonNotFoundException; + void favouritePerson(ReadOnlyPerson target, ReadOnlyPerson favouritedPerson) + throws DuplicatePersonException, PersonNotFoundException; + /** Returns an unmodifiable view of the filtered person list */ ObservableList getFilteredPersonList(); diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index 59e67cb27c7a..eff3898923c0 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -87,6 +87,15 @@ public void updatePerson(ReadOnlyPerson target, ReadOnlyPerson editedPerson) indicateAddressBookChanged(); } + @Override + public void favouritePerson(ReadOnlyPerson target, ReadOnlyPerson favouritedPerson) + throws DuplicatePersonException, PersonNotFoundException { + requireAllNonNull(target, favouritedPerson); + + addressBook.favouritePerson(target, favouritedPerson); + indicateAddressBookChanged(); + } + @Override public void sortPerson(String option) throws NoPersonFoundException { requireNonNull(option); diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/seedu/address/model/person/Person.java index e5ce114050c5..fbee02ecfe9b 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/seedu/address/model/person/Person.java @@ -25,10 +25,14 @@ public class Person implements ReadOnlyPerson { private ObjectProperty tags; + private boolean favourite; + /** * Every field must be present and not null. */ - public Person(Name name, Phone phone, Email email, Address address, Set tags) { + + + public Person(Name name, Phone phone, Email email, Address address, Set tags, boolean favourite) { requireAllNonNull(name, phone, email, address, tags); this.name = new SimpleObjectProperty<>(name); this.phone = new SimpleObjectProperty<>(phone); @@ -36,14 +40,14 @@ public Person(Name name, Phone phone, Email email, Address address, Set tag this.address = new SimpleObjectProperty<>(address); // protect internal tags from changes in the arg list this.tags = new SimpleObjectProperty<>(new UniqueTagList(tags)); + this.favourite = favourite; } - /** * Creates a copy of the given ReadOnlyPerson. */ public Person(ReadOnlyPerson source) { this(source.getName(), source.getPhone(), source.getEmail(), source.getAddress(), - source.getTags()); + source.getTags(), source.getFavourite()); } public void setName(Name name) { @@ -122,6 +126,14 @@ public void setTags(Set replacement) { tags.set(new UniqueTagList(replacement)); } + public boolean getFavourite() { + return favourite; + } + + public void setFavourite(boolean favourite) { + this.favourite = favourite; + } + @Override public boolean equals(Object other) { return other == this // short circuit if same object @@ -132,7 +144,7 @@ public boolean equals(Object other) { @Override public int hashCode() { // use this method for custom fields hashing instead of implementing your own - return Objects.hash(name, phone, email, address, tags); + return Objects.hash(name, phone, email, address, tags, favourite); } @Override diff --git a/src/main/java/seedu/address/model/person/ReadOnlyPerson.java b/src/main/java/seedu/address/model/person/ReadOnlyPerson.java index 13e571eb51b7..442c87d38308 100644 --- a/src/main/java/seedu/address/model/person/ReadOnlyPerson.java +++ b/src/main/java/seedu/address/model/person/ReadOnlyPerson.java @@ -22,6 +22,7 @@ public interface ReadOnlyPerson { Address getAddress(); ObjectProperty tagProperty(); Set getTags(); + boolean getFavourite(); /** * Returns true if both have the same state. (interfaces cannot override .equals) diff --git a/src/main/java/seedu/address/model/person/UniquePersonList.java b/src/main/java/seedu/address/model/person/UniquePersonList.java index 5b020d3b0652..26d9734b0ce5 100644 --- a/src/main/java/seedu/address/model/person/UniquePersonList.java +++ b/src/main/java/seedu/address/model/person/UniquePersonList.java @@ -30,7 +30,6 @@ * @see CollectionUtil#elementsAreUnique(Collection) */ public class UniquePersonList implements Iterable { - private final ObservableList internalList = FXCollections.observableArrayList(); // used by asObservableList() private final ObservableList mappedList = EasyBind.map(internalList, (person) -> person); diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 02c4204199df..568cb58e5e1e 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -23,22 +23,22 @@ public static Person[] getSamplePersons() { return new Person[] { new Person(new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), new Address("Blk 30 Geylang Street 29, #06-40"), - getTagSet("friends")), + getTagSet("friends"), false), new Person(new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), - getTagSet("colleagues", "friends")), + getTagSet("colleagues", "friends"), false), new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), - getTagSet("neighbours")), + getTagSet("neighbours"), false), new Person(new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), - getTagSet("family")), + getTagSet("family"), false), new Person(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), new Address("Blk 47 Tampines Street 20, #17-35"), - getTagSet("classmates")), + getTagSet("classmates"), false), new Person(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), new Address("Blk 45 Aljunied Street 85, #11-31"), - getTagSet("colleagues")) + getTagSet("colleagues"), false) }; } catch (IllegalValueException e) { throw new AssertionError("sample data cannot be invalid", e); diff --git a/src/main/java/seedu/address/storage/XmlAdaptedPerson.java b/src/main/java/seedu/address/storage/XmlAdaptedPerson.java index 3332430bffa5..6c11bd874b2f 100644 --- a/src/main/java/seedu/address/storage/XmlAdaptedPerson.java +++ b/src/main/java/seedu/address/storage/XmlAdaptedPerson.java @@ -29,6 +29,8 @@ public class XmlAdaptedPerson { private String email; @XmlElement(required = true) private String address; + @XmlElement(required = true) + private boolean favourite; @XmlElement private List tagged = new ArrayList<>(); @@ -54,6 +56,7 @@ public XmlAdaptedPerson(ReadOnlyPerson source) { for (Tag tag : source.getTags()) { tagged.add(new XmlAdaptedTag(tag)); } + favourite = source.getFavourite(); } /** @@ -71,6 +74,7 @@ public Person toModelType() throws IllegalValueException { final Email email = new Email(this.email); final Address address = new Address(this.address); final Set tags = new HashSet<>(personTags); - return new Person(name, phone, email, address, tags); + final boolean favourite = this.favourite; + return new Person(name, phone, email, address, tags, favourite); } } diff --git a/src/main/java/seedu/address/ui/PersonCard.java b/src/main/java/seedu/address/ui/PersonCard.java index 5aa54e96a622..a4948a777c68 100644 --- a/src/main/java/seedu/address/ui/PersonCard.java +++ b/src/main/java/seedu/address/ui/PersonCard.java @@ -1,5 +1,8 @@ package seedu.address.ui; +import java.util.HashMap; +import java.util.Random; + import javafx.beans.binding.Bindings; import javafx.fxml.FXML; import javafx.scene.control.Label; @@ -14,6 +17,9 @@ public class PersonCard extends UiPart { private static final String FXML = "PersonListCard.fxml"; + private static String[] colors = { "red", "yellow", "blue", "orange", "brown", "green", "pink", "black", "grey" }; + private static HashMap tagColors = new HashMap<>(); + private static Random random = new Random(); /** * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. @@ -53,18 +59,40 @@ public PersonCard(ReadOnlyPerson person, int displayedIndex) { * so that they will be notified of any changes. */ private void bindListeners(ReadOnlyPerson person) { + name.textProperty().bind(Bindings.convert(person.nameProperty())); + highlightName(person); phone.textProperty().bind(Bindings.convert(person.phoneProperty())); address.textProperty().bind(Bindings.convert(person.addressProperty())); email.textProperty().bind(Bindings.convert(person.emailProperty())); person.tagProperty().addListener((observable, oldValue, newValue) -> { tags.getChildren().clear(); - person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); + initTags(person); }); } + private static String getColorForTag(String tagValue) { + if (!tagColors.containsKey(tagValue)) { + tagColors.put(tagValue, colors[random.nextInt(colors.length)]); + } + + return tagColors.get(tagValue); + } + /** + * Initialise the tags with colours + */ private void initTags(ReadOnlyPerson person) { - person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); + person.getTags().forEach(tag -> { + Label tagLabel = new Label(tag.tagName); + tagLabel.setStyle("-fx-background-color: " + getColorForTag(tag.tagName)); + tags.getChildren().add(tagLabel); + }); + } + + private void highlightName(ReadOnlyPerson person) { + if (person.getFavourite()) { + name.setStyle("-fx-text-fill: red"); + } } @Override diff --git a/src/main/java/seedu/address/ui/PersonListPanel.java b/src/main/java/seedu/address/ui/PersonListPanel.java index d3a5fbae42bb..12299c8bbbdd 100644 --- a/src/main/java/seedu/address/ui/PersonListPanel.java +++ b/src/main/java/seedu/address/ui/PersonListPanel.java @@ -29,6 +29,7 @@ public class PersonListPanel extends UiPart { public PersonListPanel(ObservableList personList) { super(FXML); + setConnections(personList); registerAsAnEventHandler(this); } diff --git a/src/test/java/seedu/address/logic/commands/AddCommandTest.java b/src/test/java/seedu/address/logic/commands/AddCommandTest.java index 1729fe5ecdb3..391798886779 100644 --- a/src/test/java/seedu/address/logic/commands/AddCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddCommandTest.java @@ -129,6 +129,12 @@ public void updatePerson(ReadOnlyPerson target, ReadOnlyPerson editedPerson) fail("This method should not be called."); } + @Override + public void favouritePerson(ReadOnlyPerson target, ReadOnlyPerson favouritedPerson) + throws DuplicatePersonException { + fail("This method should not be called."); + } + @Override public ObservableList getFilteredPersonList() { fail("This method should not be called."); diff --git a/src/test/java/seedu/address/testutil/PersonBuilder.java b/src/test/java/seedu/address/testutil/PersonBuilder.java index 800d20bb56fe..55e2ed07b715 100644 --- a/src/test/java/seedu/address/testutil/PersonBuilder.java +++ b/src/test/java/seedu/address/testutil/PersonBuilder.java @@ -9,6 +9,7 @@ import seedu.address.model.person.Person; import seedu.address.model.person.Phone; import seedu.address.model.person.ReadOnlyPerson; + import seedu.address.model.tag.Tag; import seedu.address.model.util.SampleDataUtil; @@ -32,7 +33,8 @@ public PersonBuilder() { Email defaultEmail = new Email(DEFAULT_EMAIL); Address defaultAddress = new Address(DEFAULT_ADDRESS); Set defaultTags = SampleDataUtil.getTagSet(DEFAULT_TAGS); - this.person = new Person(defaultName, defaultPhone, defaultEmail, defaultAddress, defaultTags); + this.person = new Person(defaultName, defaultPhone, defaultEmail, defaultAddress, + defaultTags, false); } catch (IllegalValueException ive) { throw new AssertionError("Default person's values are invalid."); } diff --git a/src/test/java/systemtests/SelectCommandSystemTest.java b/src/test/java/systemtests/SelectCommandSystemTest.java index 40e0fcb134ff..c5299b12362f 100644 --- a/src/test/java/systemtests/SelectCommandSystemTest.java +++ b/src/test/java/systemtests/SelectCommandSystemTest.java @@ -25,6 +25,7 @@ public void select() { */ String command = " " + SelectCommand.COMMAND_WORD + " " + INDEX_FIRST_PERSON.getOneBased() + " "; assertCommandSuccess(command, INDEX_FIRST_PERSON); + assertCommandSuccess(command, INDEX_FIRST_PERSON); /* Case: select the last card in the person list -> selected */ Index personCount = Index.fromOneBased(getTypicalPersons().size());