diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/seedu/address/model/Model.java index bb376de4471..9caaa01e445 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/seedu/address/model/Model.java @@ -3,7 +3,6 @@ import java.util.Set; import seedu.address.commons.core.UnmodifiableObservableList; -import seedu.address.model.person.Person; import seedu.address.model.person.ReadOnlyPerson; import seedu.address.model.person.UniquePersonList; import seedu.address.model.person.UniquePersonList.DuplicatePersonException; @@ -22,7 +21,7 @@ public interface Model { void deletePerson(ReadOnlyPerson target) throws UniquePersonList.PersonNotFoundException; /** Adds the given person */ - void addPerson(Person person) throws UniquePersonList.DuplicatePersonException; + void addPerson(ReadOnlyPerson person) throws UniquePersonList.DuplicatePersonException; /** * Updates the person located at {@code filteredPersonListIndex} with {@code editedPerson}. diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index cc45d6a849f..cc3e1fcce82 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -10,7 +10,6 @@ import seedu.address.commons.events.model.AddressBookChangedEvent; import seedu.address.commons.util.CollectionUtil; import seedu.address.commons.util.StringUtil; -import seedu.address.model.person.Person; import seedu.address.model.person.ReadOnlyPerson; import seedu.address.model.person.UniquePersonList; import seedu.address.model.person.UniquePersonList.PersonNotFoundException; @@ -65,7 +64,7 @@ public synchronized void deletePerson(ReadOnlyPerson target) throws PersonNotFou } @Override - public synchronized void addPerson(Person person) throws UniquePersonList.DuplicatePersonException { + public synchronized void addPerson(ReadOnlyPerson person) throws UniquePersonList.DuplicatePersonException { addressBook.addPerson(person); updateFilteredListToShowAll(); indicateAddressBookChanged(); diff --git a/src/test/java/seedu/address/logic/commands/AddCommandTest.java b/src/test/java/seedu/address/logic/commands/AddCommandTest.java index 65bbc09fc6a..677915c081f 100644 --- a/src/test/java/seedu/address/logic/commands/AddCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddCommandTest.java @@ -69,7 +69,7 @@ private AddCommand getAddCommandForPerson(Person person, Model model) throws Ill */ private class ModelStub implements Model { @Override - public void addPerson(Person person) throws DuplicatePersonException { + public void addPerson(ReadOnlyPerson person) throws DuplicatePersonException { fail("This method should not be called."); } @@ -117,7 +117,7 @@ public void updateFilteredPersonList(Set keywords) { */ private class ModelStubThrowingDuplicatePersonException extends ModelStub { @Override - public void addPerson(Person person) throws DuplicatePersonException { + public void addPerson(ReadOnlyPerson person) throws DuplicatePersonException { throw new DuplicatePersonException(); } } @@ -129,8 +129,8 @@ private class ModelStubAcceptingPersonAdded extends ModelStub { final ArrayList personsAdded = new ArrayList<>(); @Override - public void addPerson(Person person) throws DuplicatePersonException { - personsAdded.add(person); + public void addPerson(ReadOnlyPerson person) throws DuplicatePersonException { + personsAdded.add(new Person(person)); } }