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

Unit tests in AddressBookTest needs improvement #182 #298

Closed
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion test/java/seedu/addressbook/data/AddressBookTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ public void setUp() throws Exception {

@Rule
public ExpectedException thrown = ExpectedException.none();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid auto-formatting unrelated parts of the code. Doing so can result in unrelated changes being included in the commit. You can use sourcetree to look through changes before committing, and discard any unrelated changes. If you wish to commit formatting changes to unrelated parts of the code, do so in a separate commit.


@Test
public void addPerson_emptyAddressBook() throws Exception {
emptyAddressBook.addPerson(bobChaplin);
emptyAddressBook.addPerson(bobChaplin);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid auto-formatting unrelated parts of the code. Doing so can result in unrelated changes being included in the commit. You can use sourcetree to look through changes before committing, and discard any unrelated changes. If you wish to commit formatting changes to unrelated parts of the code, do so in a separate commit.

Person bobChaplin_confirmPerson = emptyAddressBook.getAllPersons().iterator().next();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This naming style (using _ in variables), is not consistent with the rest of the code base.

assertTrue(bobChaplin.equals(bobChaplin_confirmPerson));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make use of existing methods in the AddressBook class?
(Specifically AddressBook#containsPerson(ReadOnlyPerson):boolean)

emptyAddressBook.addPerson(charlieDouglas);

UniqueTagList expectedTagList = new UniqueTagList(tagMathematician, tagScientist);
Expand Down