forked from nus-cs2103-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#855] Refactor PersonBuilder constructor to use TypicalPersons as ar…
…gument (#889) When creating a Person for testing, some tests specify almost all of the fields of an existing TypicalPerson, with only a slight variation in one or two fields. For example, the code below builds on top of TypicalPerson#AMY with only changes to address and tags: toAdd = new PersonBuilder().withName(VALID_NAME_AMY).withPhone(VALID_PHONE_AMY) .withEmail(VALID_EMAIL_AMY).withAddress(VALID_ADDRESS_BOB) .withTags(VALID_TAG_FRIEND).build(); This is long-winded and unnecessary, as PersonBuilder allows us to start from a ready-made Person, and modify as necessary. For example, the code above can be refactored to: toAdd = new PersonBuilder(AMY).withAddress(VALID_ADDRESS_BOB).build(); Let's refactor the calls to PersonBuilder to make them more concise.
- Loading branch information
Showing
3 changed files
with
8 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters