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

Conversation

nsaiisasidhar
Copy link

@PierceAndy Can you please review the PR for issue #182

@se-edu se-edu deleted a comment Oct 3, 2017
@se-edu se-edu deleted a comment Oct 3, 2017
@se-edu se-edu deleted a comment Oct 3, 2017
@se-edu se-edu deleted a comment Oct 3, 2017
@@ -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.


@Test
public void addPerson_emptyAddressBook() throws Exception {
emptyAddressBook.addPerson(bobChaplin);
emptyAddressBook.addPerson(bobChaplin);
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.

emptyAddressBook.addPerson(bobChaplin);
emptyAddressBook.addPerson(bobChaplin);
Person bobChaplin_confirmPerson = emptyAddressBook.getAllPersons().iterator().next();
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)

@PierceAndy
Copy link
Contributor

@damithc damithc closed this Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants