Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added default person peter #977

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Format: `help`
> Help is also shown if you enter an incorrect command e.g. `abcd`

### Adding a person: `add`
Adds a person to the address book<br>
Adds a person to the address book. Peter by default is already added.<br>
Format: `add NAME [p]p/PHONE_NUMBER [p]e/EMAIL [p]a/ADDRESS [t/TAG]...`

> Words in `UPPER_CASE` are the parameters, items in `SQUARE_BRACKETS` are optional,
Expand Down
15 changes: 12 additions & 3 deletions src/seedu/addressbook/data/AddressBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import java.util.Map;
import java.util.Set;

import seedu.addressbook.data.person.Person;
import seedu.addressbook.data.person.ReadOnlyPerson;
import seedu.addressbook.data.person.UniquePersonList;
import seedu.addressbook.data.person.*;
import seedu.addressbook.data.person.UniquePersonList.DuplicatePersonException;
import seedu.addressbook.data.person.UniquePersonList.PersonNotFoundException;
import seedu.addressbook.data.tag.Tag;
Expand All @@ -31,6 +29,17 @@ public class AddressBook {
public AddressBook() {
allPersons = new UniquePersonList();
allTags = new UniqueTagList();
Tag tagScientist = new Tag("scientist");
Person peter = new Person(new Name("Peter"),
new Phone("98121265", false),
new Email("[email protected]", false),
new Address("15 Science Drive", false),
new UniqueTagList(tagScientist));
try {
addPerson(peter);
} catch (DuplicatePersonException e) {
e.printStackTrace();
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/seedu/addressbook/storage/StorageFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class StorageFile {
*/

/**
* Signals that the given file path does not fulfill the storage filepath constraints.
* Signals that the given file path does not fulfill the storage filepath constraints..
*/
public static class InvalidStorageFilePathException extends IllegalValueException {
public InvalidStorageFilePathException(String message) {
Expand Down
7 changes: 6 additions & 1 deletion test/java/seedu/addressbook/data/AddressBookTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ public void addPerson_personAlreadyInListButHasTagNotInList_tagNotAdded() throws

@Test
public void containsPerson() throws Exception {
UniquePersonList personsWhoShouldBeIn = new UniquePersonList(aliceBetsy, bobChaplin);
Person peter = new Person(new Name("Peter"),
new Phone("98121265", false),
new Email("[email protected]", false),
new Address("15 Science Drive", false),
new UniqueTagList(tagScientist));
UniquePersonList personsWhoShouldBeIn = new UniquePersonList(aliceBetsy, bobChaplin, peter);
UniquePersonList personsWhoShouldNotBeIn = new UniquePersonList(charlieDouglas, davidElliot);

for (Person personWhoShouldBeIn : personsWhoShouldBeIn) {
Expand Down